Recoil is a new hook-based option in the React state management space. If you think Redux is a bit too complicated, Recoil might be the perfect state management solution for you. This tutorial will show you how easy it is to convert Redux code to Recoil code, reducing a lot of boilerplate and overall complexity.
- 00:00 - Intro
- 00:28 - Recoil vs Redux at a high level
- 01:58 - Setup: Removing Redux from the existing app
- 04:58 - using the useRecoilState hook
- 05:48 - using the setter in the recoil hook to add an item to the list state
- 08:21 - adding atoms which represent a piece of state
- 10:51 - showing the list of items in the list using the recoil state hook
- 11:47 - using the setter in the recoil hook to delete an item from the list state
- 13:25 - using the other recoil hooks to use either the state setter or the state value
- 15:18 - *Creating a custom hook to centralize the recoil state and “actions” on that state
- 21:30 - using Selectors to create derived state
- 23:41 - Showing the amount of items in the list state using the newly created selector
- 26:00 - Cleaning up and quick summary of the code
💻Get the code: https://github.com/cheetahcoding/React-Native-Tutorials/commits/recoil_tutorial
#recoil #react-native #react #javascript #developer