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

Every rerender causes a new instance to be attached #84

Open
austincondiff opened this issue Jun 1, 2022 · 2 comments
Open

Every rerender causes a new instance to be attached #84

austincondiff opened this issue Jun 1, 2022 · 2 comments

Comments

@austincondiff
Copy link

austincondiff commented Jun 1, 2022

I am using react-scroll-parallax and I am seeing an issue where if it rerenders on scroll in my case, a new instance of typical is attached to the element resulting in very janky visuals.

Screen.Recording.2022-06-01.at.11.00.19.AM.mp4

Edit: Wrapping it in a PureComponent fixes the issue, but I feel like I shouldn't need to do this.

@prashant54singh
Copy link

I am using react-scroll-parallax and I am seeing an issue where if it rerenders on scroll in my case, a new instance of typical is attached to the element resulting in very janky visuals.

Screen.Recording.2022-06-01.at.11.00.19.AM.mp4
Edit: Wrapping it in a PureComponent fixes the issue, but I feel like I shouldn't need to do this.

Have you solved this? I could not figure it out. Do you have any alternate solutions?

@austincondiff
Copy link
Author

Yeah, use a PureComponent. The problem was that it rerendered every scroll event and each time it did, a new animation was applied to the text on top of the existing animation. Putting it in a PureComponent tells React not to rerender it after it first mounts. If there is a better way to do this, I'd love to hear but this was the best I could do to fix it.

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

No branches or pull requests

2 participants