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

120
Views
reaccionar | ForwardedRef usando React.Component

Estoy creando un componente personalizado en React y necesito exportarlo usando forwardedRef. Pero cuando lo intento, aparece este error:

error

my code:

 export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>{ ref?: React.RefObject<HTMLButtonElement>; } class Button extends React.Component<ButtonProps> { render() { const { ref, children, ...otherProps } = this.props; return ( <button {...otherProps} ref={ref} > {children} </button> ) } } const ButtonForwarded = React.forwardRef<ButtonProps>((props, ref) => <Button {...props} ref={ref} /> ); ButtonForwarded.displayName = 'Button'; export default ButtonForwarded;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Cree el componente ButtonForwarded así:

 const ButtonForwarded = React.forwardRef((props: ButtonProps, ref: LegacyRef<Button>) => <Button {...props} ref={ref} /> );
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!