What can be done is wrap it in a button or an anchor tag and pass the click function else you can make it like it will use onclick function if defined otherwise checked variable will have the value from props.
|
const toggle = () => onChange(!checked); |
What can be done is wrap it in a button or an anchor tag and pass the click function else you can make it like it will use onclick function if defined otherwise checked variable will have the value from props.
react-toggle-dark-mode/src/index.tsx
Line 96 in 91c575e