Tutorial Recoil | React State Management 2022
Beto, July 17, 2022 · 2,495 views
Redux always felt like too much ceremony for sharing a bit of state, and that's exactly why I like Recoil. It's Meta's minimalistic state library: you define atoms, read them with hooks, and every subscribed component updates automatically. In the video I build a small posts app with it so you can see the whole pattern, not just isolated snippets.
Fair warning: Recoil is still experimental, but the atom mental model is worth learning either way.
What's inside
- Spin up a React project with Vite and install Recoil
- Wrap your app with to enable shared state
- Define atoms with a key and default value for your post list
- Read state with , read and write with
- Build , , and components
- Watch new posts propagate to every subscribed component
Resources

CourseReact with TypeScript course
Master state management and React fundamentals with real projects, not toy examples.
Had a win? Get featured on Code with Beto.Share your story
Like this article? Get the rest of the library plus weekly React Native tips. Free.