Context Module Function, solution
Our assignment was to take the handleSubmit function logic and move it to a Context Module Function.
- Cut the logic from handleSubmit.
- Create a new function, named updateUser.
- Paste the function implementation.
With this new function, we need to identify all of the missing dependencies and take them as functions arguments.
- First is userDispatch, which we’ll take asdispatch.
- Then take a userobject.
- And finally, the updates(or changes) we intend to make.
Then we need to return this promise — so future consumers can continue the promise chain (with additional functionality).
- Then remove this userDispatchnaming dependency by takingdispatchas an argument.
- Note that we have red squiggles because formStateand
Import and call our function
- map internal values to function arguments
TODO