Under normal circumstances, a component doesn’t interact directly with the elements in the Document Object Model (DOM). Normal interaction is through props and event handlers, which make it possible to compose applications and for components to work together without knowledge of the content they deal with.
There are some situations where components need to interact with the elements in the DOM, and React provides two features for this purpose. The refs feature—short for references—provides access to the HTML elements rendered by a component after they have been added to the DOM. The portals feature provides ...