React and Meteor Update Forms


#1

Looking for some advice, I’m new to react so I’m not sure where to start.

I’m trying to create a simple app that contains a form which I have already completed. What I’m struggling with is how to populate the form with existing data so that I can edit it.

Eg.
User Details Form
First Name
Surname
Phone

Once I’ve added the phone number I would like to be able to update if my phone number was to change.

I’ve done this using blaze however not in react. There lots of tuts explaining insert but I can’t find any simple tuts on update/edit.

Any help or advice would be appreciated.


#2

I am still trying to find an elegant solution for this but the best option I have is using conditionals with your components and creating separate view(to view the current data) and edit(form to update data) components. Specifically, you can create an “editing” state so whenever that is toggled, you can render a view or edit component.

Here’s an explanation of conditionals in React


#3

Please let me know if you found a more elegant solution.


#4

Thanks for this. I’m still trying to wrap my head around it all this. I think this explains what I’m trying to do.