1

I read through the documentation and tutorial on URL Parameters in React Router and saw that you should be able to access the parameters in this.props.params. this.props.params is undefined in my render() function. My URL currently looks like this: http://localhost:8000/?color=green and I am trying to access the color value. Is this how you access the parameters or is there any other way to do this?

1 Answer 1

1

To access a URL parameter using React Router, you would use this.props.location.query.color where color is the name of the URL parameter you want to get.

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

1 Comment

Sadly thats not working for me. I have them in this.props.location.search but not as single values

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.