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?
Props are used to pass data from one component to another. The state is a local data storage that is local to the component only and cannot be passed to other components.