We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.7.12 and earlier
event handlers using state do not work. Bound once during the first render never reassigned later:
const [counter, setCounter] = useState(0); const onMove = useCallback(() => { console.log("should increment but always 0:", counter); setCounter((counter) => counter + 1); }, [counter]); <Splide onMove={onMove}>
https://codesandbox.io/s/event-forked-mmd2vd
try to use a component state in event handler. It will be always equal to the initial state.
<Splide> component should track the event handler changes
<Splide>
The text was updated successfully, but these errors were encountered:
useEvent can solve the problem but it will be available only in next 18.3.0 React solution with useEvent
Sorry, something went wrong.
No branches or pull requests
Checks
Version
0.7.12 and earlier
Description
event handlers using state do not work. Bound once during the first render never reassigned later:
Reproduction Link
https://codesandbox.io/s/event-forked-mmd2vd
Steps to Reproduce
try to use a component state in event handler. It will be always equal to the initial state.
Expected Behaviour
<Splide>
component should track the event handler changesThe text was updated successfully, but these errors were encountered: