3 ms·
How is this different from the goal of redux or contexts other than ergonomics?
by stnmtn 3y ago
How is this different from the goal of redux or contexts other than ergonomics?
- andrewstuart 3y agoI don't see anything in common with Redux or contexts. No libraries. No higher order components. No concepts to learn. No weird rules. No complex tracing of props and trying to work out why state updates were not triggered, or were triggered. Redux is one of the most painful software development experiences I have had. Just the thought of using Redux fills me with dread. The event code above simply sends a message directly between components - that's nothing at all like Redux. Can you describe how the above is like Redux?
- usere9364382 3y agoIf you really want to be upset, take a look to see what it could have been like already with IE8 era technology https://old.reddit.com/r/javascript/comments/9vuwe3/crxcmp_should_i_open_source_you_custom_elements/ https://old.reddit.com/r/javascript/comments/9vuwe3/crxcmp_s... Link in the main comment in that thread. The library unfortunately was never released open source for reasons that are clear in that thread.
- Shorel 3y agoIt seems it was released, about one year later. https://github.com/EyeAndTea/CrxOop https://github.com/EyeAndTea/CrxOop
- usere9364382 3y agoNo, that is a different project. Judging from the github link, that was released in 2016. The reddit link is from 2018. Also see here, http://eyeandtea.com/ http://eyeandtea.com/ and in particular, http://eyeandtea.com/crxoop/v2/ch01/03 http://eyeandtea.com/crxoop/v2/ch01/03 for the documentation of CrxOop. It is just the OOP part of what you see here http://eyeandtea.com/crxcmp http://eyeandtea.com/crxcmp
- bell_tower 3y agoWhich version of Redux were you using? Have you heard of Redux Toolkit?
- pas 3y ago> No concepts to learn the concept is that events subvert React's own change detection. it's definitely more direct than stacking contexts on top of each other (... or Redux, shivers) but probably more maintainable, after all you can just search for the event name.
- pcthrowaway 3y agoYou can integrate events a bit more easily if you turn on the experimental useEffectEvent feature: https://react.dev/learn/separating-events-from-effects#declaring-an-effect-event https://react.dev/learn/separating-events-from-effects#decla...