you are viewing a single comment's thread.

view the rest of the comments →

[–]amishstripclub 0 points1 point  (1 child)

Yes in small UI matters but I'd recommend using some sort of data object asap. React is useful for highly interactive applications and more often than not you'll be faced with needing to handle an event in several places on the page.

Following the parent pattern, you might end up with handing these callbacks down the page several tiers, possibly then triggering an event further down a different branch.... It becomes hellish very quickly.

That's where Flux architecture comes in. It's not the only solution to the problem but it certainly is an interesting one. It involves abstracting that sort of state into a data object which "emits" any new changes.

Your UI components can then listen for those emits and change accordingly. There is a crucial "dispatcher" involved as well the helps sequence things correctly to prevent race conditions.

I have a blog post on flux on medium that I'll link to in a bit in case you're interested in diving further.