JavaScript/react/useRef:修订间差异
来自康健生活
| 第10行: | 第10行: | ||
const baseRef = useRef<any>();</syntaxhighlight> | const baseRef = useRef<any>();</syntaxhighlight> | ||
=== 存储数组 === | === 存储数组 === | ||
不管是 useState 还是 useRef,都是类似处理方式。 | |||
<syntaxhighlight lang="html5"> | <syntaxhighlight lang="html5"> | ||
const [ inputIpDom, setinputIpDom ] = React.useState<any[]>([])</syntaxhighlight> | const [ inputIpDom, setinputIpDom ] = React.useState<any[]>([])</syntaxhighlight> | ||