useLocalStorageState

A Hook for persisting state into localStorage.

The API is different from ahooks.

Examples

Basic Usage

Object

API

const state = useLocalStorageState<T>(
  key: string,
  defaultValue?: T | (() => T),
): T

最近更新: