Question from the React Native (Legacy) test

Which of the following snippets are valid JSX?

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> 
            );
      }
}
Author: RomainStatus: Published(Update)Question passed 357 times
Edit
1
Community Evaluations
developer avatar
Vincent Cotro
07/01/2022
Merci Romain pour la correction apportée à cette question !