Languages
[Edit]
EN

React / react-router - pass props to a child component using Router

0 points
Created by:
christa
600

In this article, we would like to show you how to pass props to a child component using React Router.

Below we create MyComponent that receives props via Route element's render() method.

Then, we simply use props.data to access the props.

Practical example:

You can run this example here.

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

React - react-router

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join