What am I missing to make it work? I suppose the answer is very easy, but really, I'm starting in React and still do not know why it does not work. If anyone knows, I am very grateful.
Thanks.
import React from 'react';
var a=30;
var b=20;
function App() {
return (
<div>
<h1>if or else</h1>
<c/>
</div>
);
}
export default App;
function c(a,b) {
if (a >= b){
return (
<div>
<h2> A is greater than B</h2>
</div>
);
}
else {
return (
<div>
<h2>B is greater than A</h2>
</div>
);
}
}
Aucun commentaire:
Enregistrer un commentaire