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 Getting Started with React Router Installing React Router and Declaring a Route

Sergio Lopez
Sergio Lopez
2,892 Points

Does this app work without using ES2015? Like regular component import?

I wonder if is needed to use the ES2015 syntax since all react router examples and tutorial works with this syntax

1 Answer

Hey Sergio,

You could absolutely use the older JavaScript syntax. Both of these two lines will serve the same function in a React application, for example:

var React = require('react'); //ES5
import React from 'react'; //ES6

The React development philosophy seems to be to try to keep things as up-to-date as possible with the newest changes to ECMAScript, so it's good to know and understand ES6 well if you are working with React applications.

Leslie