import React, { useState } from 'react' const App = () => { // save clicks of each button to its own state const [good, setGood] = useState(0) const [neutral, setNeutral] = useState(0) const [bad, setBad] = useState(0) const Statistics = (props) => { const [good, neutral, bad] = props.data const all = good + bad + neutral const avg = (all !== 0) ? (good - bad) / all : 0 const positive = (all !== 0) ? good/all*100 : "NA" return (

Statistic

Good: {good}

Neutral: {neutral}

Bad: {bad}

All: {all}

Average: {avg}

Positive: {positive} %

) } return (

Give feedback

) } export default App