Chapter 17. Context
In this chapter, you will explore React context. Context provides a way for components to access information stored higher in the component tree without needing to pass props.
To see how context works, you will set up the logic to allow Code Café’s users to log in. You will store user information at a high level in the app, since multiple components will need to access it. And you will use context to access the user information in your components.
The server API for Code Café already has login functionality, so all you need to do is build the UI to enable it. You will build a new route, /login
, that displays a form where the user will enter a username and password.
You will also add a new section to the header, next to the ...
Get React Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.