The ref is used to return a reference to the element. They should be avoided in most cases, however, they can be useful when we need direct access to DOM element or an instance of a component. Ref 用于返回对元素的引用。 在大多数情况下应该避免使用它们,但是,当我们需要直接访问 DOM 元素或组件的实例时,它们可能非常有用。 Source 来源