0

I'd like to make a side menu that shows the user what nav item and accessorarily URL path he's currently on (the Menu items allow you to navigate to say /help or /legal or /main or / )

menu

but say a user navigates to /help by entering it in the adress bar how in Reactjs would I change the highlighted menu item.

Keep in mind that the menu state is not reset by navigating these are dynamic pages.

3
  • 1
    What are you using for routing? Commented Aug 21, 2017 at 15:59
  • Your question contains code that isn't relevant. Please edit to add meaningful code that shows what you have tried so far that we can provide you with an accurate answer. Posting a Minimal, Complete, Verifiable Example that demonstrates your problem would help you get better answers. Thanks! Commented Aug 21, 2017 at 16:03
  • I'm just looking for a way to know what page I'm on I'll do the function Commented Aug 23, 2017 at 8:20

1 Answer 1

0

This will do the trick :

window.location.href

as found in : Read the current full URL with React?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.