This section provides information on how to transition from Redux to Eventrix
The transition from redux to eventrix is not that hard. Some things are named differently, but they work similarly. The following examples show what the code looks like using Redux and Eventrix.
Store
Initializing store and core elements is almost the same. Eventrix doesn't need middlewares unlike redux. Eventrix can handle asynchronous actions itself.
Instead of the reducer in eventrix, it is receiver. It differs significantly from the reducer. Receiver is responsible for receiving the event and has the ability to modify the state using stateManager. StateManager has access to the entire state, so it can download and modify any state. If you need to get some data from API, you can do it in receiver and return promise.
Redux handles the actions we pass to dispatch. Eventrix has events that are emitted by emit. Events, unlike actions, can be received by components if they register to them. This is how we enable communication between components. Method emit returns a promise waiting for all async receivers and listeners to be called. Thanks to this, you can handle the end of an event in the component.
Redux handles state change in components with useSelector. Eventrix handles this with useEventrixState. The main difference is in use and action. In terms of operation, selectors are called whenever dispach is called and redux checks if the component should rerender. Eventrix rerender component only when the change relates to the state for which the component has registered.