React Flashcards
1
Q
What’s the difference between props and state?
A
Props:
- Are input values passed to a component
- Similar to function args
- Should be treated as immutable: we should not change it’s value inside the component
- Changing props doesn’t cause a re-render
State
- Data managed by the component
- Similar to local variables
- Mutable: can be changed inside the component
- When changed will cause a re-render