Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
Child component is memoized with useMemo in the parent, how to make child component signal the parent to re-compute the value?

I'm in a situation just like this where I need to toggle between two components, both components can get significantly heavy so I memoized them.

Following the first comment from the link above, I'm using the useMemo() hook in the parent of both components so I can show/hide a particular component:

function myComponent() {
  const [activeTab, setActiveTab] = useState('Books');

  const MemoizedBooks = useMemo(() => <Books />, []);
  const MemoizedRequests = useMemo(() => <Requests />, []);
  
  return (
      <div>{activeTab === 'Books' ? MemoizedBooks : MemoizedRequests}</div>
  )
}

The problem/question

If the <Books/> component updates itself for instance, how will the parent myComponent know of this update and then update memoizedBooks?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!