Medium
###Which snippet(s) do you think are valid JSX?
Code A:
import React from "react";
class SomeComponent extends React.Component {
render () {
return (<Element>Some text</Element>);
}
}
Code B:
import React from "react";
class SomeComponent extends React.Component {
render () {
return (</Element >);
}
}
Code C:
import React from "react";
class SomeComponent extends React.Component {
render () {
return (
<div>
<Element>Some text</Element>
<Element/>
</div>
);
}
}
Code D:
import React from "react";
class SomeComponent extends React.Component {
render () {
return (
<Element a="attribute" b={this.props.b}>Some text</Element>
);
}
}
Edit
Similar QuestionsMore questions about React Native
5
Write a React Native animation that spins an image.2
Which of the following code snippets will print 'Hello World' to the console?2
How to use StyleSheet in React Native1
What is the output of the following code?
const App = () => {
const [count, setCount] = useState(0);
return ({
<Text>
The count is {count}
</Text>
<Button onPress={() => setCount(count + 1)}>
Increase
</Button>
});
};
export default App;
1
I can launch the debugger in Chrome from my app, I run `react-native log-ios` from my command line