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

Feature: Custom Hook #19

Open
chriskolenko opened this issue Aug 1, 2019 · 2 comments
Open

Feature: Custom Hook #19

chriskolenko opened this issue Aug 1, 2019 · 2 comments

Comments

@chriskolenko
Copy link
Contributor

chriskolenko commented Aug 1, 2019

While this is an easy way to get the "context"

<UserData.Consumer>{context => 
...
</UserData.Consumer>

A hook would make my code easier to read.

const UserProfile = () => {
    const context = useUser(); // better name needed

    return (....)
}

Thoughts?

@thchia
Copy link
Owner

thchia commented Aug 2, 2019

Totally agree that we should get some hooks going on!

@chriskolenko
Copy link
Contributor Author

chriskolenko commented Aug 8, 2019

Sorry, forgot about this feature request.

I'll have sometime next week to send a PR. Looks like a one liner tho.

Example:

export const useStateValue = () => useContext(StateContext);

What do you think is a good name for the function?

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

No branches or pull requests

2 participants