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