react-router-guards
react-router-guards copied to clipboard
Expose new `LoadingPageComponentType` and `ErrorPageComponentType` types
Description
This fixes an issue with the PageComponent type not allowing for the error prop, that's used for error page components
Related issues
Addresses #56
What this does
- Adds
RouteErrorto export, removesRecord<string, any>fromRouteErrortype definition (this can only ever be a string or null) - Adds new
LoadingPageComponentTypeandErrorPageComponentTypetypes to describe the type of React component expected (added to export) - Updates usage of
PageComponentto use specificLoadingPageComponentorErrorPageComponenttypes - Updates intermediate example with
NotFoundto useerrorprop - Removes unused
stylelintreference
How to test
- Pull down the repository and install (
npm i,npm run bootstrap,npm start) - Visit the router config at
/demos/intermediate/src/router/index.tsx - Confirm there is no error when passing the
NotFoundcomponent intoerrorprop - Visit the project http://localhost:3001
- Visit a Missingno Pokémon. Confirm small error message appears under body text like so: