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

100
Views
Pasar datos a un componente secundario

Estoy haciendo un menú de desplazamiento suave. El menú es un componente y, por lo tanto, está en un archivo jsx separado.

Se ve a continuación:

 const SideTabs = (props) => { const [value, setValue] = React.useState(0); const handleChange = (event, newValue) => { setValue(newValue); }; console.log(value) return ( <IconContainer> <Tabs orientation="vertical" //change value={value} onChange={handleChange} > <Tab icon={<SearchIcon />} label={value === 0 ? <Typography variant="subtitle3">Search</Typography>: ""}/> <Tab icon={<WorkIcon />} label={value === 1 ? <Typography variant="subtitle3">Role</Typography>: ""}/> <Tab icon={<AccountBoxIcon/>} label={value === 2 ? <Typography variant="subtitle3">People</Typography>: ""} /> <Tab icon={<ViewCompactIcon/>} label={value === 3 ? <Typography variant="subtitle3">Build</Typography> : ""} /> </Tabs> </IconContainer> ) };

Sin embargo, quiero que se desplace suavemente usando las identificaciones de esto.

 const JobPost = () => { const [value, setValue] = React.useState(0); const handleChange = (event, newValue) => { setValue(newValue); }; return ( <PageDiv> <IconContainer> <SideTabs/> </IconContainer> <Navbar/> <InitialSearch_INPUT id="search"/> <Tstdiv id="role"> hello </Tstdiv> <Tstdiv2 id="people"> Hi </Tstdiv2> <Tstdiv3 id="build"> Hell1 </Tstdiv3> </PageDiv> ); };

Luego lo vincularé internamente desde el archivo original usando el desplazamiento de reacción, similar a esto:

 <Link to="role" spy={true} smooth={true} offset={-40} duration={500}> <Tab icon={<WorkIcon />} label={value === 0 ? <Typography variant="subtitle3">Role</Typography>: ""}/> </Link>

la razón por la que no puedo hacer lo anterior solo es porque necesito establecer el valor usando React state AND scroll.

No estoy seguro de cómo hacer esto, pero creo que requiere accesorios.

¡Algunas ideas!

Saludos

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!