Skip to content

Possible custom hooks example 647 #1049

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

Conversation

josephlarrivy
Copy link

Issues

#647

Summary

Using reducer and use_reducer, I built a simple example of how I would build a custom hook custom hook in _examples that is able to return multiple functions to another file

Checklist

  • Tests have been included for all bug fixes or added functionality.
  • The changelog.rst has been updated with any significant changes.

@rmorshea
Copy link
Collaborator

I think the goal of use_reducer is to avoid the need to return multiple functions - instead of having a function for each possible operation you might want to perform on your state, you have one function that you pass an "action" which determines how your state will transition.

@josephlarrivy
Copy link
Author

Alright. I was looking at using this as a simple example to build up to more complicated hooks. I'll have to play around with use_reducer a bit more to get used to using it.

@rmorshea
Copy link
Collaborator

I'm going to close this for now. Thanks for the submission though!

@rmorshea rmorshea closed this Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants