在组件安装之前进行授权检查的最佳做法是什么?
我使用react-router 1.x
这是我的路线
React.render((
  <Router history={History.createHistory()}>
    <Route path="/" component={Dashboard}></Route>
    <Route path="/login" component={LoginForm}></Route>
  </Router>
), document.body);
这是我的仪表板组件:
var Dashboard = React.createClass({
  componentWillMount: function () {
    // I want to check authorization here
    // If the user is not authorized they should be redirected to the login page.
    // What is the right way to perform this check?
  },
  render: function () {
    return (
      <h1>Welcome</h1>
    );
  }
});