Question · JavaScript and React course · Module 3: State and Events

State vs Props

What is the difference between state and props?

Answer options

  • State is only in classes, props only in functions
  • There is no difference
  • Props are local, state is global
  • State is data the component manages itself and changes with its setter function (e.g. setCount); props come from the parent and are read-only

You can check the correct answer by solving this task in the CodeWorlds game.