State:-
State is used to store data and information about components .state is an updatebal structure and it can change over time.
Change in state happens when the user is in an action or system event. State determines the behaviour of a component, state is also defined how it behaviour.
State is used to represent local state and information of components. A state must be kept as simple as possible. It can be accessed by the component or modified by the component directly.
Props:-
Props is a read only component. It is an object which is used to store the value of attribute .Props work similar to an HTML attribute.
Props are allowed to pass data from component to component.
Props is similar to function arguments and can be passed to the component the same way as an argument passed in a function.
Props are immutable , so props can not modify inside the component.
Difference between state and props
0 Comments