So I have a React App And it has 2 pages Lets say 1st one is Home and 2nd one is My Portfolio Section And My Portfolio Section has 2 functional components in it
Home.js
import React from 'react'
const Home = () => {
return (
<h1>Home Screen</h1>
)
}
export default Home
Portfolio Section
import React from 'react'
import Projects from '../components/Projects'
import Testimonials from '../components/Testimonials'
const Portfolio = () => {
return (
<>
<h1>Portfolio</h1>
<Projects/>
<Testimonials/>
</>
)
}
export default Portfolio
When I visit Home , Portfolio everything loads fine but when I re-visit them again they again reload each and everytime
I don't want the Projects component in the Portfolio Section to load more than once I want it to load only once on the Startup / when launching the site even before visiting the Portfolio section ( that is in background ) as it has large files that will take time to load and stay the same until user refreshes the page voluntarily .
The component has some 3d models in it which uses three.js So it is not a static site It will have its own animation But the entire component loading each time the page visited will take a lot of time
But the Testimonials component will change dynamically
So in 2 of the components I want one to stay the same without reloading And other to change dynamically
How can I make a component load only once Any suggestion would help me I saw UseMemo but I don't know whether that would help me If so can someone explain how to use it in my case