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

[🥸🤠🥳]: Add new APIs #1

Merged
merged 10 commits into from
Jul 24, 2022
Merged

[🥸🤠🥳]: Add new APIs #1

merged 10 commits into from
Jul 24, 2022

Conversation

haneenmahd
Copy link
Owner

This PR adds new APIs to the library.

@haneenmahd haneenmahd added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 24, 2022
@haneenmahd haneenmahd self-assigned this Jul 24, 2022
@haneenmahd haneenmahd added this to the v1 🚀 milestone Jul 24, 2022
Copy link
Owner Author

@haneenmahd haneenmahd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved ✅ !

Comment on lines 1 to 14
/**
* 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>[]}
*/
Copy link
Owner Author

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 };
Copy link
Owner Author

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 👍🏻 !

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haneenmahd haneenmahd merged commit 27f67c0 into main Jul 24, 2022
@haneenmahd haneenmahd deleted the simplify-state-management branch July 27, 2022 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant