Skip to content
New issue

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

Glider is not reinitialized after event handlers are updated #106

Closed
kevinfarrugia opened this issue Feb 28, 2022 · 1 comment · Fixed by #107
Closed

Glider is not reinitialized after event handlers are updated #106

kevinfarrugia opened this issue Feb 28, 2022 · 1 comment · Fixed by #107
Assignees
Labels

Comments

@kevinfarrugia
Copy link
Owner

When an event handler is updated, Glider is not reinitialized with the new event handler.

Example

    const [activeSlide, setActiveSlide] = React.useState(1);

    const handleSlideChange = (event: CustomEvent) => {
        console.log(activeSlide); // output: 1

        if (event && event.detail) {
            setActiveSlide({activeSlide: event.detail.slide});
        }
    };

In the example above, we are updating the state variable activeSlide whenever the slide changes, however the value output in the console.log will remain 1, even if the value of activeSlide has changed.

@hipstersmoothie
Copy link
Collaborator

🚀 Issue was released in v3.0.4 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants