Local Host does not show anything


#1

Hi Everyone,

https://www.codecademy.com/courses/react-101/lessons/components-render-each-other/exercises/component-render-action?action=lesson_resume

I followed the instructions and when I ran my code, the tasks got ticked off as correct, yet the browser did not display anything. Can anyone see why?

//ProfilePage.js//

var React = require('react');
var ReactDOM = require('react-dom');
var NavBar = require('./NavBar');

var ProfilePage = React.createClass({
  render: function () {
    return (
      <div>
        <NavBar />
        <h1>All About Me!</h1>
        <p>I like movies and blah blah blah blah blah</p>
        <img src="https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-monkeyselfie.jpg" />
      </div>
    );
  }
});

ReactDOM.render(<ProfilePage />, document.getElementById("app"));

//NavBar.js //

var React = require('react');

var NavBar = React.createClass({
  render: function () {
    var pages = ['home', 'blog', 'pics', 'bio', 'art', 'shop', 'about', 'contact'];
    var navLinks = pages.map(function(page){
      return (
        <a href={'/' + page}>
          {page}
        </a>
      );
    });
    module.exports = NavBar;
    return <nav>{navLinks}</nav>;
  }
});

#2

Put this code to the last line like instruction says:

At the bottom of the file, add the line module.exports = NavBar;


#3

Thank you very much!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.


Component Rendering In Action - Browser Won't Display Content