#useEffect vs router loader
3 messages · Page 1 of 1 (latest)
The loader gets called, when navigating to the route.
The useEffect gets called, after the component on the route has rendered which triggers its call.
Also, if you are using defaultPreload='intent', then hovering on the <Link> caches loads the data and caches it.
The best experience for data caching in react would have to be Tanstack Query. Which can also be integrated with Router, so data fetching and caching is available throughout the app.