And these still aren't intrinsically tied to a component lifecycle.
See react's official docs https://react.dev/reference/react/useEffect#what-are-good-al...
They recommend using react-query (a cached fetching library) and react-router. This combination definitely uses lifecycles to fetch data in the render functions.
With react-query for example, when you use useQuery it communicates behind the scenes via Context with the react-query singleton. It doesn't fetch data because a component has rendered, it does so because a useQuery function call has asked for data it doesn't have in its cache.
That may result from a component rendering for the first time, or because that component's props changed, or because some piece of state somewhere in the app changed, etc etc. In the end it doesn't matter. It's not about a component's "lifecycle", it's responding to a change in lowercase-s state.
It does not fetch without rendering, once.
And you don’t need a useEffect to do this sort of thing. You just need a function that creates a promise keyed to whatever identifier you passed in and some state to hold its status and result.
Yes you don't need useEffect. But the alternative is something like redux, where you're components are not (self-contained) components anymore. And the docs recommend effectful libraries.
And no, you don't need useEffect or Redux. You need a promise and some state to track it. Things like react-query aren't "effectful".
So nothing ever renders.
> And no, you don't need useEffect or Redux. You need a promise and some state to track it. Things like react-query aren't "effectful".
Of course a Promise is a side effect. You're talking bullshit.
And a side effect and useEffect are not at all the same thing. You're conflating generic software terms with APIs that have very specific meanings and functions within React.
useEffect is a side effect in a render function. Not all side effects are useEffect in a render function, good job.
I stopped being a React fan with hooks, but remain a fan of Redux.