A
A
AndriiNovak132020-08-16 03:39:21
React
AndriiNovak13, 2020-08-16 03:39:21

React. I go to the cart and when I return to the main page, I render this page, the products are reloaded. How can I turn it off?

If you can write how you can turn it off, give an example code. Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tervizator, 2020-08-17
@tervizator

where is the code? poke your finger into the sky again)
As one of the options:
1) the Route changes -> the components are rendered -> the data request has gone
To remove this, you need to have everything from a separate Route or enter a variable in the isProduct editor (you can also have a different name) and from it go, if you need data, then change its state
2) you didn’t indicate the dependency of useEffect, in which the data call occurs.
There may be something else, you need to look at the code to understand better)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question