Jump to content
Search Community

Convert React Class to Function Component 😢😢😢

blizve0 test
Moderator Tag

Recommended Posts

Hi Anyone Reading This , Thanks in Advance.
I Recently Started Learning React and Started off with Function Components and Am Unable to Convert This Code to Functional Component.

Codepen Link is Above

The Very First Class Component named Particles()

which is a Class Component and I am Not Able to Convert it.

Alos Link to  CodeSandBox if you Prefer that

https://codesandbox.io/s/aerosols-ir8lf 

On the Very top Level of the File Structure there is a File particle.js

Quote

particle.js

 

Anyones Help with React and GSAP Expertise is Appreciated.

I Really Need it in Functional Component Only.

Thank You

See the Pen jOweJxv by blitzve0 (@blitzve0) on CodePen

Link to comment
Share on other sites

My suggestion would be to keep it as a class. Don't break something that isn't broken. Function components just make animation code harder to follow and reason about. If you really want to continue forward, then I would suggest go through our React Guides first as they are mostly focused on function components. 

 

 

  • Like 2
Link to comment
Share on other sites

13 minutes ago, blizve0 said:

The Very First Class Component named Particles()

which is a Class Component and I am Not Able to Convert it.

 

And that's not a component. It's just a normal JavaScript class and would work the same even if you didn't include React, so leave it as is. 

 

A class component extends React.

class MyComponent extends React.Component {

}

 

  • 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.
×
×
  • Create New...