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

276
Views
React philosophy of "moving state up" causes massive parent component

I'm working on a simple react app that quickly becomes unmanageable due to the "moving state up" philosophy. In the app, there are a number of nested fields in which the user inputs all kinds of data: strings, pixel grids, etc. Each field is a component.

Then, when the user is done, they can export their work in JSON format. Because of this, the parent technically needs access to the state of all the children, so I moved the state from each of the (nested) fields all the way to the parent component. But this becomes massively unwieldy: all the functions for modifying state are concentrated in the parent class, and prop-drilling abounds. This isn't a plain old form--the user is creating an entire document, with nested subsections, so the state and all of the functions that modify it are quite complex.

Here's the thing: the parent component does not need the state of the children until the export button is clicked, and all it needs to do is read it. One could therefore imagine a different solution: store the state in the relevant child component until export, and then, the parent function could collate the states of all its children in a JSON file and export. This seems like a much more elegant solution.

Is there a react-y way of doing this--that is, storing state in children, but sending it up to the parent upon request?

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!