Skip to content

Commit 4aae8e9

Browse files
authored
examples: use right way to reverse state in examples code 'CheckboxWithLabel.js' (#14184)
1 parent bf16169 commit 4aae8e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/react-testing-library/CheckboxWithLabel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default function CheckboxWithLabel({labelOn, labelOff}) {
66
const [isChecked, setIsChecked] = useState(false);
77

88
const onChange = () => {
9-
setIsChecked(!isChecked);
9+
setIsChecked(draft => !draft);
1010
};
1111

1212
return (

0 commit comments

Comments
 (0)