Question · JavaScript and React course · Module 10: React Ecosystem and Future

Rules of React and the Compiler

Which practice BREAKS the Rules of React and may cause errors in React Compiler?

Answer options

  • Using useState for component state management
  • Creating a new array using the spread operator [...items].sort()
  • Direct mutation of props inside a component: data.sort()
  • Using useEffect for side effects

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