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

185
Views
Pase accesorios a la función de diseño de orden superior en Next JS

Tengo este componente de diseño como componente de orden superior:

 import PropTypes from 'prop-types'; Layout.propTypes = { children: PropTypes.node.isRequired, type: PropTypes.string.isRequired }; function Layout({ children, type }) { return ( <div> {children} {type} </div> ); } export function withLayout(Component) { Component.Layout = Layout; return Component; }

Lo estoy usando con otro componente como este:

 import Layout from './ function ChildElement() { return ( <> This is the child element </> ); } export default withLayout(ChildElement);

¿Cómo puedo pasar el accesorio de type desde withLayout(ChildElement) ?

He intentado pasarle el accesorio de tipo pasando un accesorio a <ChildElement type="Hello" /> pero eso solo funcionará en <ChildElement /> y no withLayout() ¿Cómo hago que funcione?

Gracias por adelantado.

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!