K
K
Konstantin Frank2016-07-12 21:47:52
React
Konstantin Frank, 2016-07-12 21:47:52

How to forward a variable between separate components?

Hello!
The application uses react-router. There are two separate components - First and Second. The first component contains a Link with the URL of the second component. It is required to pass a variable without using query in Link. At the moment, I have connected withRouter, but I did not find anything in the documentation about adding custom variables. How can this problem be solved? Or just context forwarding from the parent for both components (for example, App)?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2016-07-12
@kostya-frank

For such cases, it is better to use redux. And so, from parent to child https://facebook.github.io/react/docs/transferring...

A
Astero_lol, 2016-07-21
@Astero_lol

The URL can be forwarded using this.props.params react router - shown in detail in this video - https://www.youtube.com/watch?v=ZBxMljq9GSE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question