Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 534 Bytes

prevent-reach-router-redirect-error-screen-in-dev.md

File metadata and controls

15 lines (13 loc) · 534 Bytes

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 />
);