I have the following code in React Native from a Udemy tutorial I'm following. However, when I try to run it, I keep getting an error about createClass. I am not able to continue the tutorial since this doesn't run. How do I fix it?
var React = require('react-native');
var {
Text,
View,
AppRegistry
} = React;
/*
var AppRegistry = React.AppRegistry;
var Text = React.Text;
var View = React.View;
// same as:
// var Text = React.Text;
// var View = React.View;
*/
var StopWatch = React.createClass({
render: function() {
return <View>
<Text>
00:00.00
</Text>
{this.startStopButon()}
{this.lapButon()}
</View>
},
startStopButon: function() {
return <View>
<Text>
Start
</Text>
</View>
},
lapButon: function() {
return <View>
<Text>
Lap
</Text>
</View>
},
}
});
/*
AppRegistry.registerComponent('stopwatch', function() {
return StopWatch;
});
*/
AppRegistry.registerComponent('stopwatch', () => StopWatch);