Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Jumbotron not working after Bootstrap install on fresh Create-React-App

I'm having a similar issue but it's with the Jumbotron not working. This is what terminal is showing me:

Failed to compile.

./src/App.js  
    Line 7:  'Jumbotron' is not defined  react/jsx-no-undef
Search for the keywords to learn more about each error.

My App.js looks like this:

import React, { Component } from 'react';

class App extends Component {
  render() {
    return (
      <div>
        <Jumbotron>
          <h1>Hello, world!</h1>
          <p>This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
        </Jumbotron>
      </div>
    );
  }
}

export default App;

My index.js looks like this:

import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.css';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';

ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();

This has to do with the Customizing Your Project video in the React Track btw. Not sure how to tag this question to that particular spot.

https://teamtreehouse.com/library/customizing-your-project

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

As you'll see in the video, you'll need to import the Bootstrap components you use.

Adnan Khan
Adnan Khan
1,618 Points

Thanks for this!

Hahaha. Yup. I finally gave up and continued the video to find that out.... Sorry for jumping the gun there!