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 502 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!
2
Which of the following code snippets will print 'Hello World' to the console?0
Which of the following code snippets will print 'Hello World' to the console?5
Write a React Native animation that spins an image.1
Which of the following snippets are valid JSX?1
How to set the background color of a View in React Native2
How to use StyleSheet in React Native1
I can launch the debugger in Chrome from my app, I run `react-native log-ios` from my command line