Answer the question
In order to leave comments, you need to log in
Component mounted multiple times?
There is a component, a page with a blog post, on this page, recommended posts in the sidebar and under the post at the bottom of the page.
I just noticed that the component is loaded 2 times and sends a request for recommendations 2 times.
Why is the component reused and not from the cache?
How to prevent it?
Answer the question
In order to leave comments, you need to log in
Because these are 2 different component instances. The component is cached, not its state.
Out of the box, alas, there is no solution for the singleton component. If such a need arises, you will have to manually take care of ensuring the general state and the absence of unnecessary requests.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question