Closed markusenglund closed 3 years ago
2 quick points:
const [checked, setChecked] = useState(false);
const handleChange = () => setChecked(!checked);
Switch
, so when I try to import Switch into my component, it suggests that one first. Not the biggest deal, but if I am not careful which one I am importing - there are no errors, but it doesn't show the Switch component... I guess this is kinda unfortunate, but I would think easily solvable by using something like Toggle or ReactSwitch in your demos... no?checked
state and the internal state of the switch go out of sync somehow.
I plan to get the release out next weekend. You can check out the latest demo here. Please write if you find any issues.
It's possible to use the new version by running
npm install react-switch@beta
What's new
Added
aria-checked
attribute (@monicahung)Fixed
Changed
checked
state is not changed in theonChange
callback, the switch will now go back to its previous position instead of getting stuck halfway. This means the switch will move back and forth if theonChange
callback changes the state after an asynchronous operation.