How to pass props through the router React

Asked

Viewed 459 times

0

How to pass props through the

<Link to=''>

I need to get the information from another component

  • Have you read about Withrouter? https://reacttraining.com/react-router/web/api/withRouter

1 answer

0

You can use an object instead of a string in the 'to' and so you can send props via the state property

<Link to={{
  path: '/login'
  state: { someData: [] }
}} />

Browser other questions tagged

You are not signed in. Login or sign up in order to post.