Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 487 Bytes

index.md

File metadata and controls

28 lines (21 loc) · 487 Bytes

useState

管理 state 的 Hook

Usage

import { useState } from 'v3-use'
const [state, setState] = useState(1)

Reference

const [state, setState] = useState<T>(initialValue?: T | (() => T))

Type Declarations

export declare function useState<T>(
  initialValue: T | (() => T)
): [Ref<UnwrapRef<T>>, (value: T | ((c: UnwrapRef<T>) => T)) => void]
export declare function useState<T = any>(): [
  Ref<T>,
  (value: T | ((c: T) => T)) => void
]