<ToggleButton>
Component
<ToggleButton>
is a <Button>
component with toggleable active
state each time the <ToggleButton>
is clicked.
This is equivalent to a <Button>
with onClick
event handles the active
property via useState()
.
If you want to handle the active
property programatically, thus the <ToggleButton>
becomes useless. So it's better to use <Button>
directly.
Here the demo: