What is the difference between state and props in React?
Asked 07 September, 2021
Viewed 3K times
  • 58
Votes

I was watching a Pluralsight course on React and the instructor stated that props should not be changed. I'm now reading an article (uberVU/react-guide) on props vs. state and it says


  

Both props and state changes trigger a render update.

Later in the article it says:


  

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?

30 Answer