useLoader
A hook to retrieve the result of a route's loader. Use this in the route component of a route with a loader prop.
import { useLoader } from 'react-sprout';
let data = useLoader();
- Name
data- Type
- any
- Description
The result of the loader
Calling useLoader in a route without a loader prop throws an error.
Suspense
While the loader is busy, useLoader will suspend your component. Use a react suspense boundary somewhere up in the component tree to display a fallback user interface.
Errors
When the loader has thrown an error, useLoader will throw that error during render. Use a react error boundary somewhere up in the component tree to display an error handling user interface.