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

Other affected views

The only previously defined view that needs modification for a logged-in user is the application header.

The app header

There's now a notion of the user being logged in. Adjustments need to be made to the application header to configure the links for login, logout, sign-up, and creating a new blog post. The application header component source now looks like this:

File: js/views/appHeader.jsx

import React from 'react'; import Reflux from 'reflux'; import { Link, History } from 'react-router'; import Actions from 'appRoot/actions'; import SessionStore from 'appRoot/stores/sessionContext'; export default React.createClass({ mixins: [ Reflux.connect(SessionStore, 'session'), History ], logOut: function () { Actions.logOut(); this.history.pushState('', ...

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