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

354
Views
¿Cómo puedo hacer que el componente acepte elementos dentro?

Quiero hacer un componente pero quiero que uno también acepte elementos. Por ejemplo :

Componente :

 const Example = () => { return ( <div> //Some Elements will come here. </div> ) }

Otra página :

 const App = () => { return ( <Example> <div> <h1>Hello all </h1> <p>I want that elements acceptable on my custom component </p> </div> </Example> ) }

Pero solo puedo enviar accesorios y no puedo escribir nada dentro de las etiquetas de mi componente. ¿Cómo puedo hacerlo? ¡Gracias por todo!

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

0

React definió un accesorio especial llamado children . Eso es exactamente lo que necesitas.

Prueba así

 const Example = ({ children }) => { return <div>{children}</div>; }; const App = () => { return ( <Example> <div> <h1>Hello all </h1> <p>I want that elements acceptable on my custom component </p> </div> </Example> ); };
about 4 years ago · Juan Pablo Isaza Report

0

Puedes usar accesorios.niños

 const Example = props => { return <div>{props.children}</div>; };
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!