use-one

A simple state management library in react app. State sharing and persist never been so easy :)

MIT License

Downloads
261
Stars
10
Committers
4
use-one - v1.4.3

Published by suhaotian 6 months ago

Revert: 'use client'

use-one - v1.4.2

Published by suhaotian 6 months ago

  • Feat: add use client to Provider.tsx component
  • Chore(README): Add SSR application persist storage chapter
use-one - v1.4.1 Latest Release

Published by suhaotian 6 months ago

  • Feat: export emitPersistReady and onPersistReady utils

Full Changelog: https://github.com/suhaotian/use-one/compare/v1.4.0...v1.4.1

use-one - v1.4.0

Published by suhaotian 6 months ago

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, now it's more make sense 💪

Full Changelog: https://github.com/suhaotian/use-one/compare/v1.1.1...v1.4.0

use-one - v1.4.0-beta.4

Published by suhaotian 6 months ago

  • Fix: isReady always false after clean

Full Changelog: https://github.com/suhaotian/use-one/compare/v1.4.0-beta.3...v1.4.0-beta.4

use-one - v1.4.0-beta.3

Published by suhaotian 6 months ago

  • Feat: add usePersist hook to persist any hooks's state

Full Changelog: https://github.com/suhaotian/use-one/compare/v1.4.0-beta.2...v1.4.0-beta.3

use-one - v1.4.0-beta.2

Published by suhaotian 6 months ago

What's Changed

Full Changelog: https://github.com/suhaotian/use-one/compare/v1.4.0-beta.1...v1.4.0-beta.2

use-one - v1.4.0-beta.1

Published by suhaotian 6 months ago

  • Fix: persistStore wrong when cahce data is null
  • Refactor(examples): refactor examples use new style
use-one - v1.4.0-beta.0

Published by suhaotian 6 months ago

  • 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 });
use-one - v1.3.0-beta.3

Published by suhaotian 6 months ago

  • Feat: add transform: state => state to persistStore's options
use-one - v1.3.0-beta.2

Published by suhaotian 6 months ago

  • Fix types
use-one - v1.3.0-beta.1

Published by suhaotian 6 months ago

**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 });
use-one - v1.2.0-beta.1

Published by suhaotian 8 months ago

  • Feat: support server components

Use different entry with 'react-server': './index.js',
inspired from https://www.npmjs.com/package/server-only?activeTab=code

use-one - v1.1.1

Published by suhaotian 10 months ago

Add keywords in package.json

use-one - v1.1.0

Published by suhaotian 11 months ago

  • Change .replaceState to .setState
  • Deprecated .replaceState
use-one - Publish v1.0.0

Published by suhaotian over 1 year ago

  • Breaking Change: createOne rename to create, and deprecated
    createOne

  • Breaking Change: remove setState please use replaceState instead

  • remove tsdx and add bunchee

  • remove MAX_UPDATE_COUNT_NUMBER

  • clean types: syncState and replaceState support oldState => newState

  • export type createOptions => export type CreateOptions

  • add test, e2e tests, and npm auto release github actions

  • update deps and use pnpm

  • add changelog

  • Update README

use-one - 0.10.1-beta.0 update deps

Published by suhaotian almost 2 years ago

Now no more manual install eventemitter3,

And remove tsdk bundle replace with bunchee.

use-one - 0.9.7

Published by suhaotian about 3 years ago

fix esm module import error

use-one - 0.9.5

Published by suhaotian almost 4 years ago

  • fix bug
use-one - 0.8.2

Published by suhaotian about 4 years ago

  • Add .syncState method, this method just sync state without emit update, useful for list component update