Re:Making Sense of React Server Components
by consilient on Wednesday September 06, 2023 @02:15PM
(#37408891)
That's not a bunch of separate caveats, it's a few principles illustrated with lots of examples.
- Don't use effects for things that aren't genuinely effectful
- Put finnicky state management stuff in reusable utils instead of re-implementing it from primitives over and over again.
Neither is React-specific.
Re:Making Sense of React Server Components
by paulddraper on Wednesday September 06, 2023 @02:26PM
(#37409080)
tl;dr Don't use useEffect if there is an alternative.
That's a bunch of examples where there are good alternatives.
[0] https://react.dev/learn/you-might-not-need-an-effect