Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactJS | Refs #7

Open
MauricioAires opened this issue Feb 12, 2023 · 0 comments
Open

ReactJS | Refs #7

MauricioAires opened this issue Feb 12, 2023 · 0 comments

Comments

@MauricioAires
Copy link
Owner

Refs are a function provided by React to access the DOM element and the React element that you might have created on your own. They are used in cases where we want to change the value of a child component, without making use of props and all. They also provide us with good functionality as we can use callbacks with them.

When to use refs

Helpful when using third party libraries.
Helpful in animations.
When not to use refs

Should not be used with functional components because they don’t have instances.
Not to be used on things that can be done declaratively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant