S
S
Space Around2019-08-17 09:28:10
React
Space Around, 2019-08-17 09:28:10

How to pass data to a new page in React?

How to pass data to a new page in React using Redux without a server? There is an input, the value of which is written to the state of the component that renders it, and then when the button is clicked, a new page is loaded that displays the data entered in the input on the previous page.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Suntsev, 2019-08-17
@GreyCrew

In this case, keep the state not in the state, but in the store.
1) Create an action by which you will save the state of the input
2) Create an action creater function through which you will transfer data to the reducer
3) Pass data from the reducer to the store
4) Get data from the store in the second page.
There is no quick fix here, read the documentation for details.
Here is an example of a simple architecture, via redux ducks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question