What is a backup instance in response?

Although the term “support instance” is often mentioned in most documents, I could not understand what that means. From interactive documents:

To interact with the browser, you will need a link to the DOM node. You can attach ref to any element that allows you to reference the backup instance of the component. This is useful if you need to call imperative functions on a component or want to access the underlying DOM nodes. link

This simplified API component is designed for components that are pure props. These components do not have to maintain internal do not have instances of support and do not have component life cycle methods. link

Since stateless functions do not have a backup instance , you cannot attach a link to a stateless function component. This is usually not, since stateless functions do not provide an imperative API. Without an imperative API, you cannot do much with anyway. However, if the user wants to find the DOM node component of the stateless function, they must wrap the component in a state component (for example, a component of the ES6 class) and attach ref to the shell component.

+4
source share
1 answer

A reverse instance is an in-memory object that represents a node. Things like state are usually stored here.

So, if you have a stateless component, you will not have an instance of support, because it is well stateless.

A few points regarding stateless components:

  • No life cycle methods
  • No link
+2
source

All Articles