Re:Making Sense of React Server Components
by danielvaughn on Wednesday September 06, 2023 @04:20PM
(#37410727)
To be fair I wasn't very clear, but what I meant was like this:
function SomeComponent({ someProp }) {
function doStuff() {
// do stuff
}
useEffect(doStuff, [someProp])
}
This trivial example is easy to read, but as more state and effects get added to a component, it quickly becomes fairly cumbersome to figure out the exact order in which your code runs.
Re:Making Sense of React Server Components
by c-hendricks on Thursday September 07, 2023 @08:43AM
(#37418087)
They're side effects, by the very nature of them, if you're putting them in your code you shouldn't care which order they run.
Thing about async/await.
The order of the written code and the order of the executed codes are two different things. Being able to write code in proximate/logical order is a enormous relief, even if things don't actually happen like that.Same with hooks.