What is the difference between state and props?

Technology CommunityCategory: ReactWhat is the difference between state and props?
VietMX Staff asked 3 years ago

Both props and state are plain JavaScript objects. While both of them hold information that influences the output of render, they are different in their functionality with respect to component. i.e,

  • Props get passed to the component similar to function parameters
  • state is managed within the component similar to variables declared within a function.