arrow_backBACK TO DRILLS
Black Beltrules-of-hooksPREMIUM
Multiple useSWR Hooks With Suspense Triggers a Hooks Order Warning
SWR is configured with suspense: true, and the component calls useSWR twice.
REACT_MODULE // 0x42
function Dashboard() {
const { data: user } = useSWR('/api/user', fetcher, { suspense: true });
const { data: stats } = useSWR('/api/stats', fetcher, { suspense: true });
return <div>{user.name}: {stats.total}</div>;
}This intermittently logs "Rendered fewer hooks than expected." What causes it?