Click in order · JavaScript and React course · Module 12: React and TypeScript

Custom Hook with Context Validation

Arrange the code of a custom hook with context validation:

Items to click

  • return ctx; }
  • function useApp() {
  • const ctx = useContext(AppContext);
  • if (!ctx) throw new Error("Missing Provider");

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