函数: useState()
调用签名
useState<
S>(initialState:S| (() =>S)): [S,Dispatch<SetStateAction<S>>]
返回一个有状态的值,以及更新它的函数。
类型参数
参数
返回
[S, Dispatch<SetStateAction<S>>]
Version
16.8.0
参阅
https://react.dev/reference/react/useState
调用签名
useState<
S=undefined>(): [S|undefined,Dispatch<SetStateAction<S|undefined>>]
返回一个有状态的值,以及更新它的函数。
类型参数
返回
[S | undefined, Dispatch<SetStateAction<S | undefined>>]
Version
16.8.0