Re:The Simplest React Stack – Part 1: Bootstrapping and Stat...
by whalesalad on Thursday August 31, 2017 @04:30AM
(#15138986)
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.
[ Parent
| on HN ]
Re:The Simplest React Stack – Part 1: Bootstrapping and Stat...
by thenewestkid on Thursday August 31, 2017 @04:37AM
(#15139007)
Valid 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).
Re:The Simplest React Stack – Part 1: Bootstrapping and Stat...
by cies on Thursday August 31, 2017 @07:01AM
(#15139456)
I 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".
Re:The Simplest React Stack – Part 1: Bootstrapping and Stat...
by thenewestkid on Thursday August 31, 2017 @07:09AM
(#15139484)
As you wish (: You convinced me, I edited the gists and removed the antipattern. Please review it if you have a spare minute. Thx!
Re:The Simplest React Stack – Part 1: Bootstrapping and Stat...
by cies on Thursday August 31, 2017 @12:26PM
(#15141420)
Most welcome. Looks so much better. And it was whalesalad to report it first :) Have a great day!
Re:The Simplest React Stack – Part 1: Bootstrapping and Stat...
by vosper on Thursday August 31, 2017 @09:37AM
(#15140168)
I 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.