forum

Home / DeveloperSection / Forums / What is the difference between state and props in React?

What is the difference between state and props in React?

Erick Wilsom57927-Oct-2022

What is the difference between state and props in React?

Both props and state changes trigger a render update.

Props (short for properties) are a Component's configuration, its options if you may. They are received from above and immutable.
  • So props can change but they should be immutable?
  • When should you use props and when should you use state?
  • If you have data that a React component needs, should it be passed through props or setup in the React component via getInitialState?


Updated on 27-Oct-2022
Writing is my profession! I have written hundreds of article for many organizations and looking forward to work with growing organization. I am compatible to produce content in many categories including International politics, Healthcare, Education, Lifestyle, etc.. I understand the value of your time that you have invested to read my bio. #thanks

Can you answer this question?


Answer

1 Answers

Liked By