We wrap our app in
src/index.js file with the
AuthProvider component. Then we call
React.useContext in our
App component to grab the
status in our
status will be an object where the keys in the object will be the services that the user is logged into. So, we can check
status.github to check if the user is logged into GitHub.
If the user isn't logged into GitHub, we display JSX with a prompt to log in. We create a
button component where the
onClick handler calls our
login function with the string of
'github' passed in.
this change is necessary for the call to github to complete correctly, otherwise everything else is good!