Implemented feature to fetch data from the Rockets endpoint (https://api.spacexdata.com/v3/rockets) on application start, populating the Redux store with selected rocket data:
id
name
type
flickr_images
Ensured that data dispatch occurs only once during the initial application load, preventing redundant updates on re-renders.
Added functionality to dispatch an action when the "Reserve rocket" button is clicked, updating the store by setting the 'reserved' key to true for the selected rocket. Utilized a non-mutative approach, returning a new state object with the updated reservation status using either JS filter() or map() within the reducer.
All logic related to state modification is confined to the reducer, maintaining separation of concerns. In the React view file, the action is dispatched with the correct rocket ID as an argument upon button click.
Implemented feature to fetch data from the Rockets endpoint (https://api.spacexdata.com/v3/rockets) on application start, populating the Redux store with selected rocket data:
Ensured that data dispatch occurs only once during the initial application load, preventing redundant updates on re-renders.
Added functionality to dispatch an action when the "Reserve rocket" button is clicked, updating the store by setting the 'reserved' key to true for the selected rocket. Utilized a non-mutative approach, returning a new state object with the updated reservation status using either JS filter() or map() within the reducer.
All logic related to state modification is confined to the reducer, maintaining separation of concerns. In the React view file, the action is dispatched with the correct rocket ID as an argument upon button click.
Thanks