Amy Blankenship
1 min readDec 26, 2022

--

This is a good basic primer about forms, for those who didn't get the basics before jumping into frameworks. But the reason for using managed code is to be able to separate the business logic out of the View. For example, you might want to use the same form for sign up or reset password. If the api logic is in your form, now you've added complexity (having to branch based on some state the form shouldn't care about) to the View.

Additionally, usually when you have a form, it's not divorced from the rest of the app state. Say you have a form for editing a post. It will get its initial state from somewhere, and once the post is edited, the rest of the app will probably need to get that change. If you have all the business logic in the form, now the View has to care about what else it needs to do to update the app state based on the edit.

If, instead, you let that state come in from the parent, then all that can be handled in a more appropriate place, and since that logic won't be entangled with View logic, it, too, will be simpler.

A lot of people forget that the name "React" ties into Reactive programming, which has a specific meaning--largely forgotten by the React community as a whole.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

Responses (2)