Search code examples
reactjsecmascript-6babeljsecmascript-5

How could I know I am using ES6 in React?


I am trying to use react.js. I found a question while I am reading the "get started with react". (link : https://facebook.github.io/react/docs/getting-started.html)

Middle of the page, there is a statement,

Note: If you are using ES2015, you will want to also use the babel-preset-es2015 package.

However, I do not know how to find which one I am using. How could I find which one I am using?

SUM >> How could I know ES version?


Solution

  • However, I do not know how to find which one I am using. How could I find which one I am using?

    You can check in the package.json of your project. Normally, you will find under the devDependencies property something that looks this way: "babel-preset-es2015": "x.y.z" (x.y.z being the version you use)

    It refers to this npm package

    Hope this helps.

    EDIT: the answer to your question:

    SUM >> How could I know ES version?

    is pretty straightforward. Check ES2015 specific syntatic features in your codebase.