What is the difference between functional and class components in React? #164945
Replies: 3 comments
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
Functional components are simple JavaScript functions. They are easier to write and use React Hooks like useState and useEffect. They are the modern and recommended way to write React components. Class components are written using JavaScript classes. They use this.state and lifecycle methods like componentDidMount. They are more complex and used in older React code. Main difference: |
Beta Was this translation helpful? Give feedback.
-
|
We made the decision to disable the ability to earn Achievements in our Community in order to discourage users from participating in coordinated or inauthentic activity like rapid questions and answers in order to earn badges. You can learn more about this decision in our announcement post here Achievements will no longer be available in the Community. Note that GitHub's Acceptable Use Policies prohibits coordinated or inauthentic activity like rapid questions and answers. As a result, we'll be unmarking the answer and locking this post. Any future violations may result in a temporary or indefinite block from the Community. Thanks for understanding. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
please someone explain
Beta Was this translation helpful? Give feedback.
All reactions