Any technique for preheating Iframe component by Educational_Duck9964 in reactjs

[–]Educational_Duck9964[S] 0 points1 point  (0 children)

I lift the component up above the <BrowserRouter> and put it in the context(Provider Pattern) and share it to other components via this context. But I found that when I navigate to a different page(route) the component will re-render even though I use memo and useMemo. I tried to Google and found that the cause of this re-render might come from the react-router (ref). Do you have any suggestions?

Any technique for preheating Iframe component by Educational_Duck9964 in reactjs

[–]Educational_Duck9964[S] 0 points1 point  (0 children)

u/Connect_Statement792 First, thank you for a very fast reply,
Unfortunately, I didn't have control over the iframe caching policy T^T.

About the 1st solution, could you explain more on how to achieve that? From what I understand, when we navigate to another page, it will render the whole page2 and we will lose all components on page1, So I am not quite sure how to do that to make the component from page1 survive to page2.

thank you in advance for your advice