function App() {
const [state, setState] = useState({ x: 10, y: 10 });
return (
<div>
({state.x}, {state.y})
<br />
<input
type="range"
min="0"
max="100"
step="1"
value={state.x}
onChange={e => {
const x = parseInt(e.target.value, 10);
setState(({ y }) => ({ x, y }));
}}
/>
<Slider axis="xy" x={state.x} y={state.y} onChange={setState} />
<Slider
axis="x"
x={state.x}
onChange={({ x }) => setState(state => ({ ...state, x }))}
/>
<Slider axis="y" y={state.y} onChange={({ y }) => setState(state => ({ ...state, y }))} />
</div>
);
}