diff --git a/examples/react-testing-library/CheckboxWithLabel.js b/examples/react-testing-library/CheckboxWithLabel.js index c6355b73836f..861848a54c95 100644 --- a/examples/react-testing-library/CheckboxWithLabel.js +++ b/examples/react-testing-library/CheckboxWithLabel.js @@ -6,7 +6,7 @@ export default function CheckboxWithLabel({labelOn, labelOff}) { const [isChecked, setIsChecked] = useState(false); const onChange = () => { - setIsChecked(!isChecked); + setIsChecked(draft => !draft); }; return (