From faf781b7b31521ca27ce6ae991c65d860f0d0a83 Mon Sep 17 00:00:00 2001 From: sabertazimi Date: Sun, 15 Dec 2024 15:23:14 +0800 Subject: [PATCH] fix(react-refs): use callback refs instead of string refs --- notes/Web/React/ReactBasicNotes.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notes/Web/React/ReactBasicNotes.md b/notes/Web/React/ReactBasicNotes.md index 1bc45976a2..2ef071ebcb 100644 --- a/notes/Web/React/ReactBasicNotes.md +++ b/notes/Web/React/ReactBasicNotes.md @@ -814,6 +814,10 @@ class UserInput extends Component { this.input = input } + componentDidMount() { + this.input.focus() + } + render() { return ( <>