Skip to content Skip to sidebar Skip to footer

What Are Refs In React Or React-Native And What Is The Importance Of Using Them

While going through react documentation I came across Refs. I want to know why Refs are used, what is purpose of using them. I haven't used them before in any previous projects. So

Solution 1:

There is a good explanation here: https://facebook.github.io/react/docs/refs-and-the-dom.html

There are a few good use cases for refs:

  • Managing focus, text selection, or media playback.

  • Triggering imperative animations.

  • Integrating with third-party DOM libraries.

Avoid using refs for anything that can be done declaratively.


Post a Comment for "What Are Refs In React Or React-Native And What Is The Importance Of Using Them"