# Function useState

- useState<S>(initialState): [S, Dispatch<SetStateAction<S>>]

- Returns a stateful value, and a function to update it.

  #### Type Parameters

  - S

  #### Parameters

  - initialState: S | (() => S)

  #### Returns [S, Dispatch<SetStateAction<S>>]

  #### Version

  16.8.0

  #### See

  https://react.dev/reference/react/useState

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1869
- useState<S>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>]

- Returns a stateful value, and a function to update it.

  #### Type Parameters

  - S = undefined

  #### Returns [S | undefined, Dispatch<SetStateAction<S | undefined>>]

  #### Version

  16.8.0

  #### See

  https://react.dev/reference/react/useState

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1877