15 lines
295 B
TypeScript
15 lines
295 B
TypeScript
import React from "react"
|
|
|
|
interface Props {
|
|
active: boolean
|
|
onChange: (to: boolean)=>void
|
|
}
|
|
|
|
const SwitchButton: React.FC<Props> = ({active,onChange}) => {
|
|
return (
|
|
<button onClick={()=>onChange(!active)} > {active?"YES":"NO"} </button>
|
|
)
|
|
}
|
|
|
|
export default SwitchButton
|