Jump to content
Search Community

Page transitions in React with Highway

virtualbis test
Moderator Tag

Recommended Posts

Hi and welcome to the GreenSock forums.

 

It seems that Highway doesn't work with React or Vue, as mentioned in this issues:

 

https://github.com/Dogstudio/highway/issues/50

https://github.com/Dogstudio/highway/issues/64

 

For route transitions in React I'd recommend using React Transition Group, which basically delays the mount/unmount process of the components allowing you to add animations to such events.

 

Happy Tweening!!!

 

  • Like 3
Link to comment
Share on other sites

This is my app.js. Not sure how to even begin a page transition

 

import React, { useState } from "react";
//Adding Components
import Home from "./Components/Home";
import Game from "./Components/Game";
import Myp from "./Components/Myp";
import Tutorial from "./Components/Tutorial";
//Import Styles
import "./styles/app.scss";

function App() {
  const [pageStatus, setPageStatus] = useState(1);
  return (
    <div className="App">
      <section>
        {(() => {
          switch (pageStatus) {
            case 1:
              return (
                <Game pageStatus={pageStatus} setPageStatus={setPageStatus} />
              );
            case 2:
              return (
                <Tutorial
                  pageStatus={pageStatus}
                  setPageStatus={setPageStatus}
                />
              );
            case 3:
              return (
                <Myp pageStatus={pageStatus} setPageStatus={setPageStatus} />
              );
            default:
              return (
                <Home pageStatus={pageStatus} setPageStatus={setPageStatus} />
              );
          }
        })()}
      </section>
    </div>
  );
}

export default App;

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...