Closed anyars-encarta closed 1 year ago
In this project, I added a functionality such that:
[ ] When a user clicks the "Join Mission" button, an action is dispatched to update the store.
[ ] The selected mission's ID is used to update the state.
[ ] The state is not mutated.
[ ] A new state object is returned with all missions.
[ ] The selected mission has an extra key reserved with its value set to true.
[ ] I used the map() function to set the value of the new state - i.e.:
map()
const newState = state.map(rocket => { if(mission.id !== id) return mission; return { ...mission, reserved: true }; });
[ ] All the logics are placed in the reducer.
[ ] In the React view file, I only dispatched the action with the correct rocket ID as an argument.
In this project, I added a functionality such that:
[ ] When a user clicks the "Join Mission" button, an action is dispatched to update the store.
[ ] The selected mission's ID is used to update the state.
[ ] The state is not mutated.
[ ] A new state object is returned with all missions.
[ ] The selected mission has an extra key reserved with its value set to true.
[ ] I used the
map()
function to set the value of the new state - i.e.:[ ] All the logics are placed in the reducer.
[ ] In the React view file, I only dispatched the action with the correct rocket ID as an argument.