Merge pull request #647 from zehan12/zehan12/fix-react-cheatsheet-refs-sections

Fix Duplicate Refs Section in React Cheatsheet
This commit is contained in:
Fechin authored and GitHub committed 2025-04-08 15:37:00 +08:00
commit 7c0755a2ee
1 file changed
+2 -4
+2 -4
View File
@@ -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.