0 votes
in ReactJS by

What are forward refs?

1 Answer

0 votes

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>

Related questions

0 votes
0 votes
asked Jun 19, 2020 in ReactJS by JackTerrance
0 votes
asked Jul 2, 2019 in ReactJS by Venkatshastri