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
How to get data of a state in one step above

I am a beginner and I am learning React JS. I am making a demo project. I need a help there.

In my app.js there is routes shop.js and review.js. The data and states is in shop.js. Now how can I pass some states data on review.js from shop.js?

Image

How can I do that?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

It's recommended to lift the shared state up to their closest common ancestor (app.js). please check https://reactjs.org/docs/lifting-state-up.html

about 4 years ago · Juan Pablo Isaza Report

0

You could use Context

Context provides a way to pass data through the component tree without having to pass props down manually at every level.

In a typical React application, data is passed top-down (parent to child) via props, but such usage can be cumbersome for certain types of props (e.g. locale preference, UI theme) that are required by many components within an application. Context provides a way to share values like these between components without having to explicitly pass a prop through every level of the tree.

about 4 years ago · Juan Pablo Isaza Report
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!