mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
534 B
534 B
Prevent reach/router Redirect Error Screen In Dev
When using @reach/router's
<Redirect> with tools like
create-react-app and Gatsby, you'll get those tools' development-mode error
screen overlays whenever a redirect happens. This has to do with how
@reach/router utilizes componentDidCatch to change the path without a
render. That error screen overlay can get annoying though. Prevent it with
the noThrow prop.
return (
<Redirect to={anotherPath} noThrow />
);