recost – React Context State

A lot have changed since my latest post 4 years ago, frameworks like ReactJS, Angular and VueJS rised to be known by everyone, and along with it, libraries like Redux and RxJS have shown not to be only good but also required in almost every projects. Almost every week there is something new that we have to know.

But what made me write this post was the new React Context API that just appeared in React v16.3.

Some say that this new API has almost killed Redux in ReactJS applications, and the future will say if that’s true 🙂

Because of this i’ve created a new library to work with this new API but i’ve given it a little taste of the Redux style we are used to.

The idea behind recost is to give the possibility to the developer to handle the state changes just like we did it on Redux, by dispatching actions and handle the changes on reducers.

Also, it gives the possibility by exporting the dispatch function out of the Provider scope to inject data into the context of the Provider. This is useful if you have a component that is self contained in it’s own provider, and you want to give the possibility for an outer component to insert data into it’s context, like a list of notifications for example.

You can check the entire source code on Github along with an example and a full explanation of the library.

Hope you like it, and if you have any request or suggestion just leave a comment down bellow or open an issue on Github 🙂