- Add type
StrictPropertyCheck
, check advanced-typescript-demo
- Add
peerDependenciesMeta
to package.json
- Fix: build size
- Feat: add
use client
toProvider.tsx
component - Chore(README): Add SSR application persist storage chapter
- Feat: export
emitPersistReady
andonPersistReady
utils
🥳 Beta finally end, publish v1.4.0
New features compare to v1.1.1:
- Feat: Add
persistStore
to persist your store - Feat: Add
usePersist
to persist react hook's state - Chore(README): README reorganize and code reorganize
- Fix:
isReady
always false after clean
- Feat: add
usePersist
hook to persist any hooks's state
- Refactor: remove
eventemitter3
deps. Thanks @arkatsy ❤️
- Fix:
persistStore
wronge when cahce data is null
- Feat:
persistStore
support React Native / Expo
Usage:
import { create, persistStore, wrapState, isClient } from 'use-one';
const initialState = wrapState({ count: 0 }); // -> { ready: false, count: 0 }
const [use, store] = create(initialState);
console.log('isClient', isClient);
isClient && persistStore(store, { key: '@CACHE_KEY', debounce: 100 });
- Feat: add persist store, support react-native and web
Usage:
import { create } from 'use-one';
import { persistStore, wrapState, isClient } from 'use-one/persist';
const initialState = wrapState({ count: 0 }); // -> { ready: false, count: 0 }
const [use, store] = create(initialState);
console.log('isClient', isClient);
isClient && persistStore(store, { key: '@CACHE_KEY', debounce: 100 });
- Feat: support server components (Inspired from https://www.npmjs.com/package/server-only?activeTab=code)
- Depretated
.replaceState
, use.setState
instead
- Depretated
createOne
, usecreate
instead
- add test, e2e tests
export type createOptions
=>export type CreateOptions
- add back
createOne
but deprecated
- Clean types again
syncState
andreplaceState
supportoldState => newState
- Breaking Change:
createOne
change tocreate
- Clean types
- Use
pnpm
for install insteadyarn
- Use
event-emitter
as deps, no need addtional install - Change build: replace
tsdx
withbunchee
- Bump example depencies