Question from the React Native (Legacy) test

Archived

For the following component, which modified version allows it to be used in a React Native project?

Example:
const MyComponent=()=>(
   <div>
        My Component
       <img src="https://facebook.github.io/react-native/img/header_logo.png"/>
   </div>
)

`` jsx
Code A:
import React from 'react'
const MyComponent=()=>(

<div> My Component <img src="https://facebook.github.io/react-native/img/header_logo.png"/> </div> )

Code B:
import React from 'react'
import{Div, Img} from 'react-native'
const MyComponent=()=>(

<Div> My Component <Img src="https://facebook.github.io/react-native/img/header_logo.png"/> </Div> )

Code C:
import React from 'react'
import{View, Image} from 'react-native'
const MyComponent=()=>(
<View>
My Component
<Source image={{uri:"https://facebook.github.io/react-native/img/header_logo.png"}}
</View>
)

Code D:
import React from 'react'
import{View, Text, Image} from 'react-native'
const MyComponent=()=>(
<View>
<Text>
My Component
</Text>
<Source image={{uri:"https://facebook.github.io/react-native/img/header_logo.png"}}/>
</View>
)

Author: Victor SabatierStatus: Archived(New question!)Question passed 123 times
-1
Community Evaluations
developer avatar
Iheb
11/01/2022
La correction est invalide car le reponse A et B est valide seulement en reactJS on a pas de IMG et DIV en RN
developer avatar
Auteur anonyme
11/01/2022
Bonjour Iheb, il y a effectivement une erreur dans la correction ! Je vais mettre à jour la question. Merci beaucoup.
developer avatar
Auteur anonyme
12/01/2022
Bonjour, la bug est valide