Skip to content

Commit

Permalink
chore: removed line that is no longer relevant
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline authored Jul 20, 2024
1 parent 1076904 commit 62742e7
Showing 1 changed file with 0 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const SomeComponent = () => {

1. We create a variable named `firstNameInputRef` using `useRef` to reference the DOM element (initially null) and use `useEffect` to focus the input element on the initial render.
1. Inside `useEffect`, we check if `firstNameInputRef.current` exists (it will be the actual DOM element after the initial render). If it does, we call `focus()` to set focus on the input.
1. The dependency array `[firstNameInputRef.current]` ensures `useEffect` only runs once when the reference changes (i.e., after the initial render).

### Referencing a non-DOM element using the useRef Hook

Expand Down

0 comments on commit 62742e7

Please sign in to comment.