Skip to content

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

Open
@kamleshwebtech

Description

@kamleshwebtech

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions