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 trialGiuseppe Barbera
1,933 Pointsindex.html output blank page
how can se the output in index.html ? in localhost all works fine, but index.html i see only the menu, no router etc etc
3 Answers
Jonathan Dewitt
8,101 PointsTo use this with current versions of react-router (v4) you need to use a switch element. This is how I got mine to work:
// Routes
const routes = (
<Router history={History}>
<App>
<Switch>
<Route exact path="/" component={Home} />
<Route path="/about" component={About} />
<Route path="/courses" component={Courses} />
<Route path="/teachers" component={Teachers} />
<Route component={NotFound} />
</Switch>
</App>
</Router>
);
Alexander Davison
65,469 PointsTo see errors, press Cmmd+Shift+i on a Mac and Ctrl-Shift-i on Windows. I recommend doing this on Google Chrome or Firefox since I think you have to install things when using other browsers.
Giuseppe Barbera
1,933 PointsNo error in console, in i launch npm start and localhost all work fine.. but if open the html Only page blank..the bundle.js its compiled...
Alexander Davison
65,469 PointsCan you show your HTML?