reactjs / react-router-tutorial

5.52k stars 1.75k forks source link

Lesson 05:Uncaught TypeError: Cannot read property 'createClass' of undefined #341

Open wayung opened 5 years ago

wayung commented 5 years ago

// App.js
import React from 'react'
import { Link } from 'react-router'

import NavLink from './NavLink'

export default React.createClass({
  render() {
      return (
          <div>
              <h1>React Router Tutorial</h1>
              <ul role="nav">
                  <li><NavLink to="/about">About</NavLink></li>
                  <li><NavLink to="/repos">Repos</NavLink></li>
              </ul>
              {this.props.children}
          </div>
      );
  }
})

// NavLink.js
import { React } from 'react'
import { Link } from 'react-router'

export default React.createClass({
    render() {
        return <Link {...this.props} activeClassName="active" />
    }
})