nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32
https://nodemcu.readthedocs.io
MIT License
7.64k stars 3.12k forks source link

Redux state container for ESP8226, ESP32 #3420

Closed shubham-sri closed 3 years ago

shubham-sri commented 3 years ago

Missing Feature: NodeRedux - state container

Redux is a predictable state container for JavaScript apps. So we can use the same concept to manage the state of ESP devices. It helps you write applications that behave consistently.

Justification

The whole global state of your app is stored in an object tree inside a single store. The only way to change the state tree is to create an action, an object describing what happened, and dispatch it to the store. To specify how the state gets updated in response to an action, you write pure reducer unctions that calculate a new state based on the old state and the action.

Workarounds

I have translated the logic of Redux in JS to Lua. You can check here

nwf commented 3 years ago

Closing; further discussion can take place on the PR.