MovablePoint can now be used directly
No longer are users stuck using useMovablePoint
—now you can bypass that abstraction and use MovablePoint
itself.
const [point, setPoint] = useState([0, 0])
<MovablePoint
point={point}
onMove={setPoint}
/>
useMovablePoint
was only ever a nice wrapper around useState
for movable points.
setPoint
Similarly, useMovablePoint
now exposes a setPoint
function to make it easy to move your point programmatically!
const point = useMovablePoint([0, 0])
function onClick() {
point.setPoint([1, 0])
}