what is babel transpiler code example
Example 1: transpiler Babel
npm install --save-dev @babel/preset-react
Copy
Example 2: transpiler Babel
export default React.createClass({
getInitialState() {
return { num: this.getRandomNumber() };
},
getRandomNumber() {
return Math.ceil(Math.random() * 6);
},
render() {
return
Your dice roll:
{this.state.num}
;
}
});
Copy