Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Callback Refs in React 16.3

Callback Refs were introduced before React 16.3.
React 16.3 continues to support the callback refs from the previous versions. In createRef API we create a reference and set it to the element using the ref attribute. In callback refs we instead set the ref attribute to a function which receives the component/element reference as an argument and sets the reference.

The below example shows how to define and use callback refs.


This post first appeared on C# Guide, please read the originial post: here

Share the post

Callback Refs in React 16.3

×

Subscribe to C# Guide

Get updates delivered right to your inbox!

Thank you for your subscription

×