Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Refactor contection #56

@alexdln

Description

@alexdln
  1. The documentation and descriptions currently use unintuitive names. I'm changing dispatch to setStore to avoid confusion with the dispatch logic in useReducer; listen to subscribe, unlisten to unsubscribe to make it clear they're waiting for an action and not enabling interactivity; and the callback argument to onStoreChange, similar to one in useSyncExternalStore.
  2. The enabled option in listen is removed - it adds too much logic, while it is easy for the user to repeat it manually (just write the condition inside onStoreChange)
  3. Improved logic for launching useStore, comparing stores, and analyzing status

All these changes, with the exception of removing enabled from listen, are internal and should not affect existing projects in any way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions