-
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
😎: Dump react-like state management #9
Conversation
We have made a huge update 🙌! Instead of using the react-like array destructing state management, we are now just returning the instance, which is much more far better in terms of code readability and DX as the dev might need to destructure again to get the instance, which is a bad idea 👎
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.
- Deprecate
registerEffect
and introduce a much easier way. If we are concluding that there is no better solution that will improve the DX, we will stick with the existing one. - Update docs
lib/createState.ts
Outdated
@@ -45,17 +41,14 @@ import type { | |||
function createState<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.
Maybe we could have an update for the registerEffect
hook too? As we are switching style, I think it might be time for it to be removed too 👍🏻 !
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.
✅
Simplify
createState()
Description
This PR comes with a huge update 🙌!
Instead of using the react-like array destructing state management, we are now just returning the instance, which is much more far better in terms of code readability and DX as the dev might need to destructure again to get the instance, which is a bad idea 👎
Linked issues
Does this PR introduce breaking changes?
Yes.
This PR changes the way we get and set the value of state and since now, it passes out a simple instance rather than providing the getter, setter and instance as a separate elements of an array.