Jul 2, 2019 in React JS

What are forward refs?

1 Answer

0 votes
Jul 2, 2019

Ref forwarding is a feature that lets some components take a ref they receive, and pass it further down to a child.

const ButtonElement = React.forwardRef((props, ref) => (
  <button ref={ref} className="CustomButton">

// Create ref to the DOM button:
const ref = React.createRef();
<ButtonElement ref={ref}>{'Forward Ref'}</ButtonElement>
Click here to read more about React JS
Click here to read more about Insurance

Related questions

0 votes
Jun 19, 2020 in React JS