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

😎: Dump react-like state management #9

Merged
merged 11 commits into from
Aug 18, 2022
Merged

Conversation

haneenmahd
Copy link
Owner

@haneenmahd haneenmahd commented Aug 16, 2022

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

  • None

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.

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 👎
@haneenmahd haneenmahd added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 16, 2022
@haneenmahd haneenmahd added this to the v1 🚀 milestone Aug 16, 2022
@haneenmahd haneenmahd self-assigned this Aug 16, 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.

  • 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

@@ -45,17 +41,14 @@ import type {
function createState<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.

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

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 348073b into main Aug 18, 2022
@haneenmahd haneenmahd deleted the simplify-create-state branch August 18, 2022 16:01
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.

None yet

1 participant