3 ms·
Surprised to see the state store caring about events. Checking for a keycode in your system to add an event to a store feels like a violation of separate concer
by whalesalad 9y ago
Surprised to see the state store caring about events. Checking for a keycode in your system to add an event to a store feels like a violation of separate concerns. That was an immediate turnoff for me with this post.
- thenewestkid 9y agoValid point. You can move that logic to the component and leave the store for pure data manipulation and handling only. I do that for bigger projects, but in this case I wanted to make things short. The goal of this series is not to teach patterns but to promote a simple and flexible stack that you can use with the patterns that you like. (In your case you can move the view specific logic to the level of the components).
- cies 9y agoI came here to say the same as whalesalad. This is not just a "you can do that if you wish" situation. This is more a case of "so much anti-pattern that it turns off readers".
- thenewestkid 9y agoAs you wish (: You convinced me, I edited the gists and removed the antipattern. Please review it if you have a spare minute. Thx!
- cies 9y agoMost welcome. Looks so much better. And it was whalesalad to report it first :) Have a great day!
- vosper 9y agoI have wondered if it would be good for debugging (assuming you're using Redux or something with a time traveling debugger) to put UI events in the store, too. Then you can have a complete picture of "how did we get to this broken state"if you need it. I would keep that stuff separate from data with a prefix, so that you could easily distinguish between the two.