Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

history.push redirects to requested url but does not render related component #31

Open
kamleshwebtech opened this issue Dec 12, 2020 · 0 comments

Comments

@kamleshwebtech
Copy link

kamleshwebtech commented Dec 12, 2020

Hello Sir

I have below routing in app function:

<Route exact path="/" component={ListOfItems}></Route>
<Route path="/list/:searchquery?" component={ListOfItems}></Route>

second Route is working well when i pass any search term but when i try to access first route '/' using history.push('/') calling by function it changes the url in the browser but does not render the component of '/' route.

import { createBrowserHistory } from "history";
const history = createBrowserHistory();

const redirectToHome = () => {
    history.push('/');
  }

could you please suggest me what is the issue? Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant