Completed 1.9 (unicafe step 4)

This commit is contained in:
2021-08-26 20:26:57 +07:00
parent 59be6fbdaa
commit b510a037b2
+12 -6
View File
@@ -13,15 +13,21 @@ const App = () => {
const avg = (all !== 0) ? (good - bad) / all : 0
const positive = (all !== 0) ? good/all*100 : "NA"
return (
<div>
<h1>Statistic</h1>
<p>Good: {good}</p>
<p>Neutral: {neutral}</p>
<p>Bad: {bad}</p>
<p>All: {all}</p>
<p>Average: {avg} </p>
<p>Positive: {positive} %</p>
{all > 0 &&
<div>
<p>Good: {good}</p>
<p>Neutral: {neutral}</p>
<p>Bad: {bad}</p>
<p>All: {all}</p>
<p>Average: {avg} </p>
<p>Positive: {positive} %</p>
</div>
}
{all === 0 && "No feedback given"}
</div>
)
}