Use next generation JavaScript, today.
myJavaScript("foobar");myNewTransformedJavaScript("yay!");Babel has support for the latest version of JavaScript through syntax transformers. These allow you to use new syntax, right now without waiting for browser support. Check out our ES2015 preset to get started. Learn about ES2015 →
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.num}
</div>;
}
});Babel has support for JSX and Flow. Check out our React preset to get started. Use it together with the babel-sublime package to bring syntax highlighting to a whole new level.
Babel is built out of plugins. Compose your own transformation pipeline using existing plugins or write your own. Easily use a set of plugins by using or creating a preset. Learn more →