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

How is it different from useState + useContext? #8

Closed
Skona27 opened this issue Nov 25, 2019 · 2 comments
Closed

How is it different from useState + useContext? #8

Skona27 opened this issue Nov 25, 2019 · 2 comments
Labels
good first issue Good for newcomers

Comments

@Skona27
Copy link
Contributor

Skona27 commented Nov 25, 2019

Hi!

I have got a question. Your library looks really like redux, but similar effect can be achieved by using useState and useContext hooks. Are there some benefits that one can get from using your solution 😃 ?

@Jahans3 Jahans3 added the good first issue Good for newcomers label Nov 25, 2019
@Jahans3
Copy link
Owner

Jahans3 commented Nov 25, 2019

Hi, sure there are some advantages but you should consider each project's needs on a case by case basis. Some of the key advantages of using this over useState + useContext would be:

There's no silver bullet for state management. A custom solution might seem like less work at first but has noticeable performance issues and may not be suitable for large or complex apps for a few reasons. Similarly, using Redux may also seem unnecessary on smaller projects and if you don't need to leverage the advanced features or large ecosystem it's likely you don't need Redux at all. There's lots of libraries out there to choose from, I'd recommend checking a few out to see what best fits your needs.

When deciding between a custom solution, this library or Redux a general rule of thumb I like to follow is:

  • Do you anticipate your app will grow large with complex state? Do you want advanced Redux features like action batching? Go with Redux
  • Is your app small with minimal, simple global state? Is performance not an issue? A custom solution may work
  • Something in-between the above? Go with a library like this

@Jahans3 Jahans3 pinned this issue Nov 25, 2019
@Skona27
Copy link
Contributor Author

Skona27 commented Nov 25, 2019

Thanks for your comprehensive anwser. I'll definitely give this a try!

@Skona27 Skona27 closed this as completed Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants