From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Create and dispatch actions

Create and dispatch actions

- [Instructor] Now we continue, we're going to create actions, and the goal here is to move the entire business logic outside of the app component, in order to handle the state management, outside separately. So we're going to add a new action, which is set inputs, and this is to update the form inputs, and we're going to do that with one handler function. I'm going to use here the same, that I'm putting right here at the top. And we're going to pass whichever value is provided, I mean sent with the payload, and that's going to be value. And the way we're going to handle this, so we're going to pass as well the states, because we want to also update with the current states, and we're going to return actually, it's going to be state inputs. So we're going to return an object, same as here, we are returning an object. And we want to update merge with the current state, then update with the value from the internal…

Contents