Use next generation JavaScript, today.
myJavaScript("foobar");
myNewTransformedJavaScript("yay!");
By default, Babel ships with a set of ES2015 syntax transformers. These allow you to use new syntax, 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.num}
</div>;
}
});
Babel ships with built-in support for JSX. Use it together with the babel-sublime package to bring syntax highlighting to a whole new level.
Babel supports user plugins. These allow you to plug into the powerful Babel transformation layer. Learn more →