124k views
7 votes
On React

1) Create counter and an increment button, default value of the counter would be 1, clicking on increment button adds 5 to the counter. The max value of the counter would be 20, after reaching this value , counter would not increment. Add a reset button which would set the counter value to 1.
[8:53 PM]
2) Create a button with label “true” , clicking on the button toggle the value from “true” => “false” and “false” => “true”.(edited)

techsith (patel) — 03/03/2021
3) Create a counter and a button. clicking on the button increments the counter by one. double clicking on the button resets the counter to 0

2 Answers

4 votes

(assuming jsx)

function Buttons (props) {

return(

{props.counterValue}

counter

increment

reset

);

}

var counterValue = 1;

function addup(a){

if(counterValue + a <= 20){

counterValue += a;

} else if (counterValue + a > 20){

//do nothing

}

ReactDOM.render(

,

document.getElementById('root')

);

}

function reset() {

counterValue = 1;

ReactDOM.render(

,

document.getElementById('root')

);

}

User Dosha
by
5.1k points
8 votes

Answer:too many words ahhh

Step-by-step explanation:

User Jorge Caballero
by
4.5k points