tinystate

Installation

You can install tinystate using npm or yarn:

npm install tinystate-react
# or
yarn add tinystate-react
# or
pnpm add tinystate-react

Usage

To create a store, use the createStore function from the tinystate library. You'll need to provide an initial state for your store:

import { createUseStore } from 'tinystate-react';

// Create a custom hook to use the store
export const useCountStore = createUseStore(0);

You can now use the useCountStore hook in your components to access and update the state.

API Reference

createUseStore: (initialState: T) => () => [state: T, setState: ((newState: T) => void)];

License

This project is licensed under the MIT License.