【发布时间】:2021-05-29 18:59:41
【问题描述】:
我在 react 中学习 typescript 但收到警告
import {useref} from 'react'
export default function test(){
cons tmp = useRef()
const data = tmp.current?.value
return (
<div>
<input type ="text" ref={tmp}/>
</div>
) }
但我收到了这样的警告
Property 'value' does not exist on type 'never'.ts(2339)
有人可以帮我解决吗?
还有一个问题,props.example() 的类型注解是什么?
【问题讨论】:
标签: reactjs typescript next.js