In this blog post we’ll describe a method for modeling forms in React. What follows is a general method for shaping form state data. It can be used with any state management tool such as Redux, MobX, another flux implementation, or even just
this.setState. We’ll be using
this.setState in this post.
First, let’s start with a basic form. For the sake of clarity, we’re ignoring styles.
In the form above, we’re not capturing the state of user input. Let’s add a state object.
First, we added an initial state object to the constuctor. I prefer to keep all of the inputs’ value state nested under an object called
... read the whole story at beautifulcode.1stdibs.com.