Can someone explain how Babel in React supports fat arrow functions as class properties? Using Babel Try it out I can see they are not supported:
class Question {
// Property (not supported)
myProp = () => {
return 'Hello, world!';
}
// Method (supported)
myFunc() {
return 'Hello, world!';
}
}
Class properties are not supported in ES6 (correct me if I'm wrong) but then in React (with Babel) they work.
I can see the difference between methods and properties using TypeScript Playground but I can't clearly understand if Babel is supporting them or not. Is there some plug-in?
UPDATE:
I can see they are supported using "babel-preset-stage-0"
.
stage-0
it works.. Babel supports them. – Megan