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

Mixins and dependencies

The items in this section contain supporting code for the views. The cookie reader/writer will be used to mock session management. The form utility mixin will be used to validate the individual form elements in all of the forms.

Reading and writing cookies

Maintaining a user session can be complex. To make it as real as possible, the session detail is put into cookies. Reading and writing cookies is a simple parsing process, but there's no need to suffer the minutiae of it. So, we picked up a simple cookie reader/writer JavaScript utility from the Mozilla Developer Network (MDN) cookies documentation page (https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie). This code was put into the file cookie.js and placed ...

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