• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: navigate(‘/’) doesn’t navigate

Resolved: navigate(‘/’) doesn’t navigate

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I’m using React Router Dom v6. So for my web application, I created a Redux action in userAction called logoutUser, and in view dashboard.jsx, I added a logout button that should navigate me to the home page ('/'). My problem is that clicking on logout does nothing, is my code wrong?
userAction.js:
dashboard:

Answer:

logoutUser is returning a function instead of executing the tasks you want. You either change it to:
Or your change your onClick part, to the code below, so you execute the function retuned by logoutUser:

If you have better answer, please add a comment about this, thank you!

javascript react-router react-router-dom reactjs redux
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Filter objects with random number keys in Es6

22/03/2023

Resolved: if(this != nullptr) returns true while this = nullptr)

22/03/2023

Resolved: ASP.NET EF : Competitor model – Game model needs reference to two competitors

22/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.