mirror of
https://github.com/Fechin/reference.git
synced 2026-11-21 05:24:10 +03:00
Merge pull request #647 from zehan12/zehan12/fix-react-cheatsheet-refs-sections
Fix Duplicate Refs Section in React Cheatsheet
This commit is contained in:
1 file changed
+2
-4
@@ -627,8 +627,6 @@ const ref = React.createRef();
|
||||
|
||||
### Accessing DOM Elements with Refs
|
||||
|
||||
### Refs are often used to access and interact with DOM elements directly. Here's an example where we focus an input element using a ref:
|
||||
|
||||
```javascript
|
||||
import React, { useRef, useEffect } from "react";
|
||||
|
||||
@@ -645,11 +643,10 @@ function FocusInput() {
|
||||
|
||||
export default FocusInput;
|
||||
```
|
||||
Note: Refs are often used to access and interact with DOM elements directly. Here's an example where we focus an input element using a ref.
|
||||
|
||||
### Managing Focus with Refs
|
||||
|
||||
### You can also manage focus between multiple elements using refs:
|
||||
|
||||
```javascript
|
||||
import React, { useRef } from "react";
|
||||
|
||||
@@ -673,3 +670,4 @@ function Form() {
|
||||
|
||||
export default Form;
|
||||
```
|
||||
Note: You can also manage focus between multiple elements using refs.
|
||||
Reference in new issue
Block a user