Integrate Recoil with TypeScript to share your state across React components

Eli Elad Elrom
Master React
Published in
18 min readSep 19, 2020

--

If you want to stay up to date with React — then Recoil is a must-know library. Recoil is Facebook’s state management experiment and the latest version at the time of writing is 0.013. It is not just another library to add to your arsenal it’s life-changing.

In this tutorial by example, you will learn Recoiljs and see if it worth integrating it into your existing or greenfield projects.

I have been wanting to learn Facebook Recoil’s state management library for React for a few weeks now.

I finally got the time to take Recoil for a spin using TypeScript and see how it goes, along the way I create a few helpful examples, that I am sharing in this article.

I will show you three examples and in the last example we will be creating in this tutorial we will use the MERN stack to submit a contact us form with Recoil;

Why should you care about Recoil?

Our story starts with Facebook Flux (Flux is a data management pattern) that talks about three ingredients;

  • Dispatcher — The central…

--

--