exercise 1.7
This commit is contained in:
parent
711764b874
commit
5f6a727ee6
|
@ -1,12 +1,17 @@
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
|
||||||
const Stats = ({ positive, neutral, negative }) => {
|
const Stats = ({ positive, neutral, negative }) => {
|
||||||
|
const total = positive - negative
|
||||||
|
const votes = positive + neutral + negative
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h2> Results </h2>
|
<h2> Results </h2>
|
||||||
<p> Positive: {positive} </p>
|
<p> Positive: {positive} </p>
|
||||||
<p> Neutral: {neutral} </p>
|
<p> Neutral: {neutral} </p>
|
||||||
<p> Negative: {negative} </p>
|
<p> Negative: {negative} </p>
|
||||||
|
<p> All: {votes} </p>
|
||||||
|
<p> Average: {total / votes} </p>
|
||||||
|
<p> Positive: {positive / votes} </p>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue