DEV Community

Discussion on: Testing React Hook State Changes

Collapse
 
dhanvinarc profile image
Dhanvin Patel

If state is changing on onClick function..than how can we test that?
const [disabled, setDisabled] = useState(true)
const addDomain = () => {
console.log("In function")
setDomains([...domains, domain.trim()])
setDisabled(false)
}