If useEffect is the answer, I'm probably asking the wrong question
If useEffect is the answer, I'm probably asking the wrong question.
Examples:
"How do I sync state?" Don't. Derive it.
"How do I fetch with plain React?" Don't. Use react-query/swr/etc.
"How do I copy URL values into state?" Don't. Use the URL as the single source of truth.
Lots of “react-query uses useEffect” comments. Yep, but my point is this:
Call an abstraction (react-query, swr, Apollo, React Router loader, etc) instead of calling useEffect yourself.