export default function Quiz() {
const [input, setInput] = useState(0);
console.log("input::::::::::>>", input);
function clickAnswerHandler() {
console.log("hitting this:::::");
setInput(1);
}
return (
<>
<p> This is the currently active Question </p>
<button onClick={() => clickAnswerHandler()}>Click {input}</button>
</>
);
}
the above code should print
input:::>>> 0
1st click
hitting this::::>>>
input:::>>> 1
2nd click
hitting this::>>>>
3rd click
hitting this::>>>>
and so on……
the above code is printing
input:::>>> 0
1st click
hitting this::::>>>
input:::>>> 1
2nd click
hitting this::>>>>
input:::>>> 1
3rd click
hitting this::>>>>
and so on……
New contributor
Owais Kapadia is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.