Skip to content

Installation

Terminal window
npm add synstate

Or with other package managers:

Terminal window
# Yarn
yarn add synstate
# pnpm
pnpm add synstate

If you are using React, install the companion hooks package:

Terminal window
npm add synstate-react-hooks

synstate-react-hooks includes all exports from synstate plus the createState, createReducer, and createBooleanState APIs extended for React, so you don’t need to add synstate along with it.

For React 16.8–17 (without useSyncExternalStore), use the compat package instead:

Terminal window
npm add synstate-react-hooks-compat

The API is identical to synstate-react-hooks. See React Integration for details.

If you are using Preact, install the companion hooks package:

Terminal window
npm add synstate-preact-hooks