How to take user input fields

(Pheakdey Yi) #1

Hi All,

Fairly new to ReactJS, was wondering if I am on a page that collects a bunch of information say

Firstname, Lastname, Sex, page that I want to then pass down to a another component, what is the best option to do this?
I know I can easily create and capture each field individually but is that the suggested option> and have the onChangeText of each to then setState?

I’m getting confused a little bit by the use of or do I only need Forms when I need to collect that data and pass to a backend service?

(Alexei) #2

Actually, more generally your question sounds like hot to store state in React applications.
Personally, I strongly recommend redux as a state container, and for small application redux-forms would be enough.
Then when you will have peformance problems there is couple of ways to optimize react-redux app. But in result you will have predicatable application which would be easy to debug.

The reason for this complexity is that react is not a framework, it’s a library which optimize rendering, and solve this issue really well. That’s why you need to solve state management by yourself.

@pheakdeyyi does it make sense for you?

(Pheakdey Yi) #3

Yes thank you!

(Kuldeep Saxena) #4

You can try out react-reactive-form.
A form library which is based on Angular’s reactive forms, it allows to create a tree of form control objects in the component class and bind them with native form control elements.

(Mark Tellez) #5

Well, it isn’t a library, but here is a video I did on creating a email form input, you can apply the techniques to your whole form.

It is part of a mutli part series that covers doing forms in react.