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

Bonus Step 6 - Create a UserFilter Context and Custom Hook #10

Open
wants to merge 27 commits into
base: 05-Bonus-ApiContext
from

Conversation

Projects
None yet
1 participant
@danieltott
Copy link
Owner

commented May 30, 2019

Here is where using Context really gets fun. We have a Selected User that needs to be passed through props to various components. While in this app, passing a prop through a couple of levels is really not a big deal, when you get to bigger apps, it can become unwieldy to pass props down through several levels. Instead, we can use the Context API to provide the data and use a custom hook to provide access to it.

We also put dispatch in our context, so that components that need to can update the selectedUser when applicable.

@danieltott danieltott changed the title Bonus Step 7 - Create a UserFilter Context and Custom Hook Bonus Step 6 - Create a UserFilter Context and Custom Hook May 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.