Use next generation JavaScript, today.
Babel will turn your ES6+ code into ES5 friendly code, so you can start using it right now without waiting for browser support. Learn more →
export default React.createClass({
getInitialState() {
return { num: this.getRandomNumber(); };
},
getRandomNumber(): number {
return Math.ceil(Math.random() * 6);
},
render(): any {
return <div>
Your dice roll:
{this.state.number}
</div>;
}
});Babel works perfectly with React, featuring a built-in JSX transformer. Use it together with the babel-sublime package to bring syntax highlighting to a whole new level.
With a large range of plugins and browser support.
Babel is available wherever you use JavaScript - so start using it today!
Babel has plugins for all of your favorite build systems. Check out the official plugins for Gulp, Grunt, Browserify, Webpack, Broccoli, and many more. You can also use the built-in CLI.
Using either the CLI or require hook, you can easily setup babel to work with your Node.js app. Module authors can also easily precompile their assets before publishing to npm.
Sprockets 4 will ship with babel by default using the `.es6` file extension. Until then you can use the Sprockets ES6 transform or the official babel Ruby Gem.
Babel and Browserify get along wonderfully with the official babelify transform babel transforms the module syntax to browserify-compatible Common.js modules by default.