Frameworks

Planning to Manage State with React? Welcome Recoil

Planning to Manage State with React? Welcome Recoil

Hey friends!

This will be really short, I promise. This is the discovery of the day and I want to share it.

Are you immersed in the JavaScript world? Or are you just getting started?

image

In both contexts probably you have heard about React. Old like me? Probably React.js

React

Just a terrible overview:

  • React is a JavaScript library
  • React allows us to build rich user interfaces
  • React allows us to build single-page applications
  • React allows us to build mobile applications
  • React is based on components

One interesting point is that React allows us to manipulate/render data. This is a more Stateless approach, which means that React has a short memory, on purpose btw.

  • Request A renders my name on the page
  • Request B completely forgets the rendered name

But usually, life works in mysterious ways and we need to know what happened previously. That’s when State Management comes handy.

React has friends. React has an important friend. Redux

Redux

If you want to have a good memory, if you want to be aware of the data you’re rendering between requests, then you’re thinking about Redux

My terrible overview again:

  • Redux is a JavaScript Library (makes some sense, isn’t it?)
  • Redux manages the application state
  • Follows the reducing function approach (which I’m gonna tell you more about later)

it sounds that React has a new friend for State Management. Welcome Recoil :)

Recoil

I’ve just discovered Recoil from Twitter, as we discover everything in life.

To be honest, I don’t know yet how it works but the pitch is great

  • You can share state easily
  • Functional concepts in its core
  • Create subscriptions to listen events asynchronously (my dream is to write this word correctly on the first attempt)
  • Amazing granularity with Atoms and Selectors

If I have some time, I’ll play around with Recoil on my weekend and give you guys a better and detailed description.

Thanks for stopping by and see you tomorrow :)

Let’s keep in touch 🙂

Twitter Youtube Instagram Linkedin

Join My Newsletter

You’ll receive coding courses, tutorials and personal posts! I’ll be happy to send them to you, weekly :)