Reputation: 731
I am starting to learn React Native. I am following a tutorial and have written the following code:
var React = require('react-native');
var {
Text,
View,
AppRegistry
} = React;
var StopWatch = React.createClass({
render: function() {
}
});
AppRegistry.registerComponent('stopwatch', function() {
return StopWatch;
});
However, I am getting this error:
undefined is not a function (evaluating 'React.createClass({displayName:'StopWatch',
render:function render() {}
})')
I run React Native in the Android simulator, using the command
react-native run-android
The file is
App.js
Upvotes: 0
Views: 324
Reputation: 4498
This doesn't really answer your question, but why do it this way using deprecated syntax?
Try the facebook react-native tutorial here: https://facebook.github.io/react-native/docs/tutorial.html
Or better yet, use the wonderful create-react-native-app
This should get you up and running
Upvotes: 4