I am using react-router + react-router-redux in my app.
What I want to achieve is every time user click a tab in the dashboard
it will change the URL to /dashboard/messages
, for instance.
However, using push('dashboard/' + page)
, every time I click a tab it will append the link.
My current situation:
- Current URL is
/dashboard
. - Click a Messages tab.
- The URL changes into
/dashboard/messages
. - Click a Home tab.
- The URL changes into
/dashboard/messages/dashboard/home
.
Is there any way to just replace the /dashboard/messages
into /dashboard/home
when we click Home tab after cliked the Messages tab?
Many thanks!
I found the silly mistake, sorry for this.
So apparently it has to be
push('/dashboard/' + page)
instead ofpush('dashboard/' + page)
.