How it works...

As you can see, the only way to retrieve the values from input forms is by using the local state with an onChange function to update the value of the input. If you connect a state to the input value, but you don't add an onChange callback to update it, you won't be able to write anything, since the Virtual DOM is not being updated, and the only way to do so is by updating our local state.

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.