-
Notifications
You must be signed in to change notification settings - Fork 0
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
[🥸🤠🥳]: Add new APIs #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved ✅ !
lib/registerEffect.ts
Outdated
/** | ||
* Register an effect for the state object specified in the argument. | ||
* This function also supports specifying multiple state objects as arguments | ||
* when you want to have a common state for multiple state objects. | ||
* | ||
* ```ts | ||
* createEffect((newValue) => { | ||
* // callback when the state is set | ||
* }, state); | ||
* ``` | ||
* | ||
* @param callback {StateCallback<T>} | ||
* @param objects {StateObject<T> | StateObject<T>[]} | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add docs which warns the user that the registerEffect
should be called before changing a state for it to take effect!
|
||
export { useState, useEffect }; | ||
export { createState, registerEffect }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
State
class will be exported when we think it is ready for extensible purposes 👍🏻 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
This PR adds new APIs to the library.