Question: 7 : 2 1 . all 3 G 7 5 4 Exercises week 3 import { useState } from 'react' const App / / save

7:21
.all 3G 754
Exercises week 3
import { useState } from 'react'
const App
// save clicks of each button to its own state
const [good, setGood]= useState ()
const [neutral, setNeutral]= useState ()
const [bad, setBad]= useState(()
return (
}
export default App
Exercises week 3
Expand your application so that it shows more statistics about the gathered feedback: the total number of collected feedback, the average score (good: 1, neutral: 0, bad: -1) and the percentage of positive feedback.
larr C (1) localhost:3000
give feedback
good neutral bad
statistics
good 6
neutral
all 9
positive 66.6666666656565565
application easily witn vite by now.
Exercises week 3
Refactor your application so that displaying the statistics
is extracted into its own Statistics component.
The state of the application should remain in the App
root component.
Remember that components should not be defined
inside other components:
I/ const Statistics } const App =()=>f const [good, setGood]= useState() const [neutral, setNeutral]= useState () const [bad, setBad]= useState(()// do not define a component within another component const Statistics =(props) const Statistics =(props)}
return (
}.
1 class comment
classroom.google.com
 7:21 .all 3G 754 Exercises week 3 import { useState }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!