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

unable to push to history on Logout button in Header.js #49

Open
anupamz1 opened this issue Mar 16, 2020 · 2 comments
Open

unable to push to history on Logout button in Header.js #49

anupamz1 opened this issue Mar 16, 2020 · 2 comments

Comments

@anupamz1
Copy link

I am unable to get history object and modify Logout feature , i had used below method on Button click:
image

@adshin21
Copy link

In the Header.js file router is not present so that the history object will also be not present.
A very simple solution is to import react-router-dom and then use withRouter HOC at the time of export.

import {withRouter} from 'react-router-dom;

export default withRouter(Header);

@adshin21
Copy link

@anupamz1 please ping me if it works or not

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

No branches or pull requests

2 participants