reach / router

Home Page:https://reach.tech/router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`useLocation` does not trigger re-render when calling hard imported `navigate`

armellarcier opened this issue · comments

Would codesandbox but the sample sandbox uses 0.0.0-rc.2 version and implementation

<a onClick={navigate("?q=1")} />
<Router>
   <MyRoute path="/*" />
</Router>
export const MyRoute = props => {
  const location = useLocation();
  return location.search ? <div>SEARCH</div> : null;
}

if navigate is imported (import { navigate } from '@reach/router';) I don't see a location change in MyRoute

if navigate = useNavigate(), it works!

I'm using a LocationProvider