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, CounterDisplayerjs
"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 updateincrease 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 CounterDisplayerjs 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 CounterDisplayerjs
using props.
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 MyCounterjs is clicked.
Meaning, when the button is clicked just once, your MyEvenCounterjs component
should just say "Clicked times". But when the button is clicked again it should say
"Clicked times". When the button is clicked for a third time it should just say "Clicked
times". When clicked again for the fourth time it should say "Clicked times" and so forth.
Display the MyEvenCounterjs 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
