markusenglund / react-switch

A draggable toggle-switch component for React. Check out the demo at:
https://react-switch.netlify.com/
MIT License
1.33k stars 101 forks source link

6.0.0 #88

Closed markusenglund closed 3 years ago

markusenglund commented 3 years ago

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

Fixed

Changed

kalmanh commented 3 years ago

2 quick points:

  1. For the hooks example, I am wondering why you wouldn't just do
    const [checked, setChecked] = useState(false);
    const handleChange = () => setChecked(!checked);
  1. I am currently using the Switch component in a project together with React Router. React Router has a named import called 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?
markusenglund commented 3 years ago
  1. Both work fine, it should only matter if the parent component checked state and the internal state of the switch go out of sync somehow.
  2. Switch is the most natural thing to call it I think. People who use the library can of course pick whatever name they like.