InterviewSolution
| 1. |
What Is The Difference Between The State And Props In Reactjs? |
|
Answer» Props: Passes in from PARENT component.<PropsApp headerProperty = “HEADER from props…” contentProperty = “Content from props…”/>This PROPERTIES are being read by PropsApp component and sent to ReactDOM View. State: Created inside component by getInitialState.this.state reads the PROPERTY of component and UPDATE its value it by this.setState() method and then returns to ReactDOM view.State is private within the component. Props: Passes in from parent component.<PropsApp headerProperty = “Header from props…” contentProperty = “Content from props…”/>This properties are being read by PropsApp component and sent to ReactDOM View. State: Created inside component by getInitialState.this.state reads the property of component and update its value it by this.setState() method and then returns to ReactDOM view.State is private within the component. |
|