-
Notifications
You must be signed in to change notification settings - Fork 4
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
Strange Scrollyteller v2.0 behaviour disregarding useState changes #18
Comments
I ran into the same issue using scrollyteller inside a functional component . I think this is related to facebook/react#14066 and not passing dependencies inside useEffect array in Scrollyteller. If I pass Did you work out a way to fix it? I think one way would be to update Scrollyteller component to be a class and use For now I changed my parent component to class and it seems to be working fine. |
Yeah it used to be a class component in version 1 before Nathan upgraded it to be a function component. Maybe it was the wrong way to go.... unless we can find a fix. |
I'm not at all familiar with this issue, but I'd say that's almost certainly the problem @katiaeirin (if it's not, it's bound to be causing other problems). The |
Seems like it could work. I'd have to try reproducing the problem to test, unless @katiaeirin you have some time to work on this a bit? |
Yep I can try doing that. |
When you use a Scrollyteller component and pass an onMarker function... and then try to use a useState state variable eg
[year, setYear] = useState(1999)
the onMarker function will not respond to changes toyear
when we call setYear and will always show the original value "1999".Seems to be something to do with the way function components work..... had to revert to version 1 of scrollyteller
The text was updated successfully, but these errors were encountered: