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
From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Introduction to Hooks API Reference2m 52s
-
(Locked)
Learn event handling and updating the state4m 12s
-
(Locked)
Handle conditional rendering3m 47s
-
(Locked)
Work with forms4m 1s
-
(Locked)
Submit the form and apply side effects: useEffect5m 32s
-
(Locked)
Validate and submit forms: useMemo6m 11s
-
(Locked)
Handle complex logic with useReducer5m 34s
-
(Locked)
Create and dispatch actions4m 37s
-
(Locked)
Compose and update the UI6m 1s
-
-
-
-
-
-
-
-
-
-