📅  最后修改于: 2022-03-11 15:02:15.241000             🧑  作者: Mango
const FocusDemo = () => {
const [inputRef, setInputFocus] = useFocus()
return (
<>
>
)
}
const useFocus = () => {
const htmlElRef = useRef(null)
const setFocus = () => {htmlElRef.current && htmlElRef.current.focus()}
return [ htmlElRef, setFocus ]
}