useReactive

This Hook is marked asdeprecatedsincev1.4.0. It has been migrated to @shined/reactive.

A React Hook that helps to use Reactive in React with ease.

Tip

You need to install @shined/reactive to use this utility.

Demo

Source
Name:
Bob
Age:
20
  • running
  • coding

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

import { create } from '@shined/reactive'; const [state, mutate] = useReactive(initialState, { create })

InitialState

An object to initialize the state.

Options

export type UseReactiveOptions = SnapshotOptions<State> & { create: typeof create }

Options for Reactive, see Reactive Create Options.

Returns

state is the current state, mutate is an object whose changes will trigger a re-render.