differences between state and props in NextJs
differences
state | props |
---|---|
Internal data, owned by component | External data, owned by parent component |
Component "memory" | Similar to function parameters |
Can be updated by the component itself | Read-only |
Updating state cuases component to re-render | Receiving new props cuases component to re-render. Usually when the parent's state has been updated |
Used to make components interactive | Used by parent to configure child component("settings") |