What is the difference between state and props in React?
State | Props |
---|---|
This is the data maintained inside the component. | This is the data passed in from a parent component. |
The component within shall update itself using the setState function. | These are read-only functions present in the child component and have to be updated manually. |
Note: React is a widely used open-source library used for building interactive user interfaces. It is a web platform licensed under MIT. This is one of the very popular react interview questions.
BY Best Interview Question ON 30 Jun 2020