4
donuts
6y

Reading a book on React and how data/changes flow one way... down.

Oh hm... sounds different...

Then after an hour or more it goes oh yeah, you can pass children callbacks.

OH WTF!!!! That's like every single language (passing the parent itself as an Interfaces), Android Fragments, Node/Express, Async finding)

That's pretty much MVC?

Comments
  • 1
    The state you'll be passing down the component tree will be local and not global.

    That's the reason why Redux, MobX, Flux, xState, and other state management libraries comes into action.

    But on a SPA with more than one route passing down the data as a children callback will definitely have some huge pitfalls.
  • 1
    @litesam126 so these libraries sort of make state global? I haven't gone that far yet. That's in chapter 11.

    I've heard of Redux before tho is that the usual pick?
  • 1
    @billgates Yup, most people choose Redux because it's simple JavaScript, in MobX you have to learn a new thing called decorators. Also, Redux has good documentation.

    Since you are new to React you can look at building components with the help of "hooks". Building components using hooks is fast and simple.

    (On a side note: React got some bigger breaking changes since the last 2 months than it was in 2 years)

    Build some cool stuffs and post the results.
Add Comment