Supporting fetching data on react-router-dom via the loader property on Route.
In react-router-dom v6, it has the data fetching capability, but it lacks a caching solution on the frontend side.
It implements the concept of fetching early to improve the user experience.
The significant drawback of not using react-query for data fetching is that it fetches data too often when relying on the built-in support provided by react-router-dom v6.
"New Features"
react-router-dom
via theloader
property on Route.react-router-dom
v6, it has the data fetching capability, but it lacks a caching solution on the frontend side.react-query
for data fetching is that it fetches data too often when relying on the built-in support provided byreact-router-dom
v6.loader
feature withreact-query
lazy
on Route componenterrorElement