diff --git a/part1/1.6-1.11-unicafe/src/App.js b/part1/1.6-1.11-unicafe/src/App.js index cd55853..58de94e 100644 --- a/part1/1.6-1.11-unicafe/src/App.js +++ b/part1/1.6-1.11-unicafe/src/App.js @@ -6,6 +6,10 @@ const App = () => { const [neutral, setNeutral] = useState(0) const [bad, setBad] = useState(0) + const all = good + bad + neutral + const avg = (all !== 0) ? (good - bad) / all : 0 + const positive = (all !== 0) ? good/all*100 : "NA" + return (

Give feedback

@@ -16,6 +20,9 @@ const App = () => {

Good: {good}

Neutral: {neutral}

Bad: {bad}

+

All: {all}

+

Average: {avg}

+

Positive: {positive} %

) }