3 ms·
To be fair I wasn't very clear, but what I meant was like this: function SomeComponent({ someProp }) { function doStuff() { // do stuff }
by danielvaughn 3y ago
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.
- c-hendricks 3y agoThey'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.