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 ...

Get React: Building Modern Web Applications 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.