Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
harp

React and GSAP error

Recommended Posts

Error:
Uncaught TypeError: Cannot add property _gsap, object is not extensible

 

import React{ useRefuseEffect } from 'react';
import { gsap } from "gsap";
 
function Loading() {
 
  // Store a reference of needed dom elements
  const loadingHeading = useRef();
 
  // wait until DOM has been rendered
  useEffect(() => {
    gsap.from(loadingHeading{ opacity: 0 })
  })
 
  return (
    <>
      <section className="loading">
        <div className="loading__content">
          <h1 ref={loadingHeadingclassName="loading__heading heading--xl color--dark-grey mb-60">
            La Camicia
          </h1>
          <p className="para--lg color--mid-grey">
            An elegant <span className="font--italic">Shirt Configurator</span> prototype created by Harpreet Singh.
          </p>
          <p className="para--lg color--mid-grey">
            Thank you for visiting. Hope you enjoy it.
          </p>
        </div>
      </section> 
    </>
  )
}
 
export default Loading;
Link to comment
Share on other sites

It would need to be like this.

gsap.from(loadingHeading.current, { opacity: 0 })

 

Be sure to check out our React Guide 😀

 

 

  • Like 2
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.
×