Question: Create a simple click counter app using React states. You will need a class component called MyCounter.js ' ' that will depend on another component

Create a simple click counter app using React states. You will need a class component called
"MyCounter.js'' that will depend on another component called, CounterDisplayer.js.
"MyCounter.js" keeps track of the click count value in a state and this is where you will
initialize your state that will hold your click counts. It is also under "MyCounter.js'' that
you will write a function, called allClicksCounter() that will update/increase your state
by one whenever a button is clicked. Under "MyCounter.js'' you will also need a button
which calls the method allClicksCounter() when it is clicked. Please display the number
of clicks right below the button. The main purpose of CounterDisplayer.js is to display
the number of times the button on the "MyCounter.js'' component is clicked. Meaning, you
will need to pass the updated click data from "MyCounter.js'' to CounterDisplayer.js'
using props.
2. Create another class component named "EvenCounterDisplayer.js". Please note that
"MyCounter.js'' will also depend on "EvenCounterDisplayer.js" to display ONLY the
even number of click counts. Meaning, your "EvenCounterDisplayer.js" tracks and
displays only the even number of times the button found under MyCounter.js is clicked.
Meaning, when the button is clicked just once, your MyEvenCounter.js component
should just say "Clicked 0 times". But when the button is clicked again it should say
"Clicked 2 times". When the button is clicked for a third time it should just say "Clicked 2
times". When clicked again for the fourth time it should say "Clicked 4 times" and so forth.
Display the MyEvenCounter.js component right below your "MyCounter.js'"
component so that you can see both counters together

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!