Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DOM vs Refs in React

What is the difference between using DOM vs Refs in React? I understand that we can use regular javascript DOM node selectors to target specific elements in react because react is javascript anyways, but you can also use refs to do the same thing. What are the benefits/disadvantages of using one vs the other?

like image 570
Paul Gege Avatar asked May 06 '26 15:05

Paul Gege


1 Answers

Its just a react way of accessing DOM nodes or React elements.

like image 93
Muhammad Haseeb Avatar answered May 08 '26 06:05

Muhammad Haseeb