L'attribut ref indique l'endroit dans la source de données à partir duquel vous voulez récupérer les données.
The ref attribute indicates where in the data source you would like to retrieve data from.
Lorsque qu'un arbre, un menu ou tout autre élément avec une source de données génère son contenu, le générateur de modèle cherche en premier lieu la ressource marquée par l'attribut ref.
When a tree, menu or other element with a data source generates content, the template builder first finds the resource referred to by the ref attribute.
Quand l'attribut ref est utilisé sur un composant de classe personnalisée, l'objet ref reçoit l'instance du composant créée dans son current.
When the ref attribute is used on a custom class component, the ref object receives the mounted instance of the component as its current.
Si nous avions voulu, nous aurions pu positionner l'attribut ref sur n'importe quelle valeur de l'attribut about afin de limiter la quantité de données retournées.
If we wanted to, we could set the ref attribute to any of the other about attribute values to limit the set of data that is returned.
En utilisant une URL de fichier pour l'attribut ref, vous pouvez choisir un répertoire/dossier à retourner.
By using a file URL for the ref attribute, you can select a specific directory to be returned.
L'attribut ref a été positionné sur l'élément racine de ce fichier, qui est la balise de premier niveau Seq.
The ref attribute has been set to the root element in the RDF file, which is the top-level Seq.
Ceci dit, useRef() est utile au-delà du seul attribut ref.
However, useRef() is useful for more than the ref attribute.
Plutôt que de passer un attribut ref créé par createRef(), vous pouvez passer une fonction.
Instead of passing a ref attribute created by createRef(), you pass a function.
L'attribut ref peut être soit un objet créé par la fonction React.createRef(), soit une fonction de rappel, soit encore une chaîne (mais cette dernière forme est dépréciée).
The ref attribute can be an object created by React.createRef() function or a callback function, or a string (in legacy API).
React.createRef forwardRef crée un composant React qui transfère la valeur de l'attribut ref qu'il reçoit à un autre composant plus bas dans l'arbre.
React.forwardRef creates a React component that forwards the ref attribute it receives to another component below in the tree.
Vous pouvez utiliser 'NC:HistoryRoot' comme valeur de l'attribut ref.
You can use NC:HistoryRoot as the value of the ref attribute.
Les refs sont créées en utilisant React.createRef() et attachées aux éléments React via l'attribut ref.
Refs are created using React.createRef() and attached to React elements via the ref attribute.
Si vous avez travaillé avec React par le passé, vous avez peut-être l'habitude d'une ancienne API où l'attribut ref était une chaîne de caractères du genre "textInput", et le nœud DOM était accessible via this.refs.textInput.
Legacy API: String Refs If you worked with React before, you might be familiar with an older API where the ref attribute is a string, like "textInput", and the DOM node is accessed as this.refs.textInput.