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

178
Views
¿Cómo pasar accesorios a un objeto de niños? los niños solo tendrán un botón o un texto
export const PopOver = ({ children, -----------------------------------------> I get children headerText, bodyText, hasHeader, hasBody, hasFooter, cancelButtonText, okButtonText, hasCloseButton, onOkPress, onCancelPress, ...rest }: PopoverProps): JSX.Element => { return ( <Popover trigger={(triggerProps) => { return <Button {...triggerProps}>Trigger</Button>; //How do I pass trigger props to the children I get??? }} {...rest} >

En el código que mencioné anteriormente, quiero devolver niños (this.props.children) en lugar del botón para hacerlo más genérico. algo al equivalente de:

 return ( <Popover trigger={(triggerProps) => { return <child {...triggerProps}>Trigger</child>; }} {...rest} >
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba esto:

 <Popover trigger={triggerProps => React.Children.map(children, child => React.isValidElement(child) ? React.cloneElement(child, { ...triggerProps }) : child ) } {...rest} />

Referencias:

https://reactjs.org/docs/react-api.html#reactchildren

https://reactjs.org/docs/react-api.html#cloneelement

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!