Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose .subscribe() to allow subscribing to state changes outside React #25

Merged
merged 6 commits into from
Feb 14, 2022

Conversation

akx
Copy link
Contributor

@akx akx commented Nov 5, 2021

Fixes #12 by exposing the subscribe() function (that returns the unsubscribe function) that is used by the state hook.

As a side effect, it made sense to have all the 3 callback/subscriber kinds also have access to the previous state.

  • Size of dist/index.js in main: 736 bytes
  • Size of dist/index.js in this PR: 776 bytes (+40 bytes, +5.4%)

@RichardLindhout
Copy link
Member

Hey this is cool!! Can you maybe add it to the README.md too?

@akx
Copy link
Contributor Author

akx commented Nov 29, 2021

Hey this is cool!! Can you maybe add it to the README.md too?

Sorry for the delay! Added a readme segment.

@RichardLindhout RichardLindhout merged commit 42ecd05 into web-ridge:main Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subscribe to state changes outside of React
2 participants