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

371
Views
React JS: ¿Cómo pasar una variable de un archivo a otro archivo, que no es padre o hijo del mismo?
import moment from "moment"; import TrackerByDate from "./traker_by_date/tabs"; export default function Calender() { const [value] = useState(new Date()); const [show, setTracker] = useState(false); const [dateState, setDateState] = useState(new Date()); const changeDate = (e) => { setDateState(e); }; var pikerdate = moment(dateState).format("YYYY-MM-DD"); function clickTracker(e) { setTracker(!show); } return ( <> {show ? <TrackerByDate dataFromParent={pikerdate} /> : null} <div style={{ width: "260px" }} className="res-calendar"> <Calendar className={["c1", "c2"]} onChange={changeDate} onClickDay={clickTracker} value={dateState} /> </div> </> );

Estoy tratando de pasar 'pikerdate' a un archivo js llamado diet . callander.js y diet.js no son padre o hijo

Quiero obtener una fecha en diet.js cuando se hace clic en la fecha en callender.js

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

0

puede hacerlo tomando "pikerdate" en el componente principal donde hay dos componentes (llamados y diiet) que son niños como en App.js o algún otro componente y pasa "pikerdate" a ambos componentes.

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!