diff --git a/part1/unicafe/src/App.js b/part1/unicafe/src/App.js index 5757347..b9be9c0 100644 --- a/part1/unicafe/src/App.js +++ b/part1/unicafe/src/App.js @@ -1,5 +1,22 @@ import { useState } from "react"; - +const Statistics = (props) => { + return ( +
+

good {props.good}

+

neutral {props.neutral}

+

bad {props.bad}

+

all {props.good + props.neutral + props.bad}

+

+ average{" "} + {(props.good - props.bad) / (props.good + props.neutral + props.bad)} +

+

+ positive {(props.good / (props.good + props.neutral + props.bad)) * 100}{" "} + % +

+
+ ); +}; const App = () => { // save clicks of each button to its own state const [good, setGood] = useState(0); @@ -16,12 +33,7 @@ const App = () => {

statistics

-

good {good}

-

neutral {neutral}

-

bad {bad}

-

all {good + neutral + bad}

-

average {(good - bad) / (good + neutral + bad)}

-

positive {(good / (good + neutral + bad)) * 100} %

+ ); };