O'Reilly logo

Mastering React by Ryan Vice, Adam Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User-related stores

There are two stores that deal with users. The user store maintains a collection of users and responds to creation and modification actions. The session context store is used to mock user sessions in a nearly genuine fashion by managing a cookie. We'll start with the session context store.

The session context store will respond to the login and logOut actions and set a login context cookie accordingly. Of course, if we were using real sessions the cookie would be set implicitly by an HTTP header via a server response to log in. Further, the cookies used in a real scenario would be the secure variety and not typically readable by JavaScript in the majority of browsers.

The session context store

This store represents the logged ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required