- Practice writing reducers
It's time to build out some reducers. We're developing an app that allows you to write a list of ingredients to buy at the store.
Write your code in src/reducers/index/js
Some notes:
- Reducers take in two arguments: state and action
- Reducers must pure
- For this application, your state should default to an empty array
- Your reducer should be able to handle
- Unknown actions
- An
'ADD_INGREDIENT'
action - A
'REMOVE_INGREDIENT'
action
In terms of functionality, a user should be able to add an ingredient and remove it by clicking on it. Use the tests as a guide. We've built out the components and relevant actions. Once you're passing the tests, run npm run start
to see your app in action!