Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript React Router Basics Navigating and Nesting Routes Setting Active Links

bundle.js:36219 Uncaught ReferenceError: Navlink is not defined

Question: Console is giving me: Uncaught ReferenceError: Navlink is not defined Why do I only get the green background? And how come it is not defined? I have followed the instruction step by step, even checked if my code matches up to that of the tutorial, and it does. Where should I look for the error?

// App.js:

import React, { Component } from 'react';
import NavLink from './NavLink';

class App extends Component {
  render() {
    return (
      <div className="container">
          <span className="icn-logo"><i className="material-icons">code</i></span>
          <ul className="main-nav">
            <li><NavLink to="/">Home</NavLink></li>
            <li><NavLink to="/about">About</NavLink></li>
            <li><NavLink to="/teachers">Teachers</NavLink></li>
            <li><NavLink to="/courses">Courses</NavLink></li>
        { this.props.children }

export default App;

// NavLink.js:

import React from 'react';
import { Link } from 'react-router';

const NavLink = props => (
  <Link {...props} activeClassname="active" />

export default Navlink;


2 Answers

Hi Julian,

At the bottom of NavLink.js, in your export statement, you did not capitalize the 'L' in NavLink. It should be:

export default NavLink;

Notice the capital 'L'. Those small errors are a pain! Hopefully that gets it working for you.

Happy coding.

Thank you so much... I've been staring down on my code for 1 hour. It fixed my problem obviously :P