Skip to content

React 18 breaks outro animation #4

@chimp1nski

Description

@chimp1nski

When using React 18 (18.2.0), at the end of the outro animation, the transitioned timeline element flashes briefly before routing to the next page and playing the intro animation.

React-18-tweenpages-bug.mov

Beware

This is not happening when using React 17 (17.0.1).

I've also deployed a production build as well as disabled react strict-mode in dev in order to see if it's the useEffect double firing that React 18 comes with. Although I might have overlooked something, I can rule this out for now.

Both React versions were tested with Next.js 12.2.3 and it seems that it's not a Next issue.


My guess is that there is a lack of cleanup functions in the useEffect hook and therefore weirdness happening but honestly I don't even know where to start debugging this.


I am not expecting you @johnpolacek to fix this, am just leaving this here for others that might experience the same weirdness.
Thank you so much for this awesome guide on how to implement such complex animation stuff!

If I'll find a fix for this (other than reverting to React 17) I'll update this issue and create a PR.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions