In ES5, I could store React classes like this:
const myReactClasses = {
inlineStyles : {
...
},
firstClass : React.createClass({
myFunction : function () {
...
},
}),
}
In an attempt to convert the syntax to ES6, I've tried:
const myReactClasses = {
inlineStyles : {
...
},
firstClass : class firstClass extends React.Component {
myFunction() {
...
},
},
}
and it compiles using gulp. However, when I navigate to the page where the React should render, I encounter the error: Uncaught TypeError: Cannot read property 'prototype' of undefined. Is this the correct way of replicating the same behavior from ES5 to ES6 and I simply messed up somewhere deeper in the application or is it wrong? And if wrong, can you please provide a sample snippet of what it should look like.