Closed hawaijar closed 6 years ago
Having the same issue (Using Chrome). 👋
You can resolve it in CodeSandbox by editing the onChangeHandler
method in this file src/switch.js
:
Replace
onChangeHandler = () => {
this.props.onClick()
}
with
onChangeHandler = e => {
this.props.onClick()
e.preventDefault()
}
Now it should behave like in the video.
Greetings Felix
Yup, that works! 😊
Nice 😊
Looked a bit more into it and it seems like there was a regression in this pull request #26 , where the e.preventDefault()
call was unintentionally removed.
I made a pull-request #29 which should fix the problem in the future.
Sorry about that! Thanks for the help!
Hello,
I was going through the codesandbox link - https://codesandbox.io/s/github/kentcdodds/advanced-react-patterns-v2 to quickly go through the exercises. I'm in the first exercise and for some reason, the toggle button didn't change its state though I applied the setState appropriately. BTW, the final exercise also exhibited the same behavior. Am I missing anything?
Oh, yes the toggle() looks same as it's there in the final exercise of 01.
Thanks, KSM