Easy
Which of the following examples works to create a React Native component?
Code A:
import React from "react";
import {Text, View} from 'react-native';
class SomeComponent extends React.Component {
render () {
return (<View><Text>Some text</Text><View>);
}
}
Code B:
import React from "react";
var SomeComponent = React.createClass(
{displayName : "SomeComponent"},
render: function() {
var textElement = React.createElement(Text, null, "Some text");
return React.createElement(View, null, textElement);
}
);
Code C:
import React from "react";
var SomeComponent = () => {
var textElement = "<span>Some text</span>";
return ;
};
Author: Victor SabatierStatus: PublishedQuestion passed 500 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!
Similar QuestionsMore questions about React Native
5
Write a React Native animation that spins an image.2
How to use StyleSheet in React Native1
Which of the following code snippets will print 'Hello World' to the console?1
I can launch the debugger in Chrome from my app, I run `react-native log-ios` from my command line1
Which of the following snippets are valid JSX?