Urgent help!--'action,state,disptach,listen...'
Closed this issue · 3 comments
Hello, I am a student who is learning about the robot virtual environment for making web pages.
Your project is of great reference value to me.
In your code, 'state, action, disptach, listen...
What knowledge do these keywords use?
I can't understand this, I hope you can give me some advice.
Those are for state management. Look for redux, flux or reflux.
Thank you for your reply.
Which architecture does your project use?
I want to study specifically first.
Eager to get your help!
I'm using a custom implementation https://github.com/glumb/robot-gui/tree/master/vendor/state which follows the concepts of flux.
So you have a store which holds the apps state and actions which mutate the state in an atomic way. You can call/dispatch and action with given parameters to change the state.
Different in this implementation is that you can listen for specific substate changes, not only the whole state.
testStore.listen([state => state.a.b.c, state => state.d], (abc, otherName) => {
// only called when state.a.b.c or state.d change
})