State management with Finite state machine


(Olivier Wietrich) #1

I’ve been using redux or mobx and was always discouraged by their complexity. The concepts and vocabulary behind those libraries seemed weird to me and I wanted to use something simple and familiar. Truth is I certainly didn’t take the extra time and efforts required to use them.

This is why I developed react-states-machine (https://github.com/bredele/react-states-machine). This module use the finite state machine pattern to compose functional components together and describe their dynamic relationships as simple function. Those functions are called transitions and are responsible to update a component or display a new one. Components are states.

Managing dynamic relationships outside of the components themselves allow to develop components in isolation and ultimately increases reusability and maintainability. Components are functional and therefore easy to understand and test. Transitions are simple functions that return props but they also can return promises which allow to easily implement asynchronous changes.

I would appreciate any comment and/or feedback you have to make this module better. If you like it, please show some love and star the project on Github :slight_smile: