News for hackers. Stuff that matters.
Re:React 19 by ww520 on Thursday December 05, 2024 @07:20PM (#42334464)
Thanks for the detail explanation. That's what I understand how React works.

Another thing I found un-intuitive with React is the state of multiple instances of the same component. The useState() hook basically references some global state in the global context. When the component is used in multiple places, i.e. <my-comp></my-comp> <my-comp></my-comp>, the useState() hook inside is called twice and somehow they get a different copy of the global state. I know the magic of the global array to track the states. It just feels a bit too magically.

I chuckle it's claimed that React component is functional. And cringe whenever people put out the UI=F(props) statement, as if calling F with the same props multiple times getting a different set of state values not the anti-thesis of being functional.

Re:React 19 by breadwinner on Thursday December 05, 2024 @09:21PM (#42335520)