Super light and dead simple state manager and event dispatcher for react.
Super light dead simple state manager and event dispatcher for React. May you never ask yourself again "where are those props coming from?". Get to the quick start. Or watch the 2 minutes video.
Acta.subscribeState('appStateKey', 'localStateKey');.
const valueFromActa = Acta.useActaState('appStateKey');that share states with class components.
Acta.setState({appStateKey: value}).
Acta.subscribeState('appEventKey', handler);.
Acta.useActaEvent('appEventKey', handler);that share events. with class components.
Acta.dispatchEvent('appEventKey', value).
In Acta states, you can store string, numbers, and booleans; in object literals and in arrays. Since all values stored have to be compatible with the local storage Maps, Sets or functions won’t work.
You don't need tooling to debug Acta. Just type
Actain your browser console and see the object and the internals.
React ecosystem already has excellent state managers. Redux and MobX are great tools. But teams tend to make a mess of their codebase with overcomplicated state management patterns because they have seen it work for big applications and online tutorials encouraging premature scaling optimizations.
Maintainability is the ability to make changes with confidence. If you cannot understand your dataflow instantly today and describe it in a simple sentence, it means that three months from now you will be lost in the layers of abstraction that you just created and that any modification will be a nightmare.
If an action calls a dispatcher to push updated data in a middleware that will look into a bunch of reducers to find the one that will transform the updated data to push them into a provider that will trigger a mapping from the transformed updated data into properties in a higher-order function that wraps the parent of the component where the data will be displayed... Well, congratulations, you made the life of the next guy hell. And this is not a caricature, some applications have way more complicated dataflow. Sometimes it's required; but if I bet that it's not your case, I'll be right 99.9% of the time.
The goal of Acta is to make you forget about reducers, observers, map to props, providers, HOCs... Components are explicitly responsible for subscribing to the state or event. You can call for a complex data treatment inside the component. You can have actions that will be triggered. But the incoming data flow should be the most direct possible.