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

Typed Provider Component

Arrange the elements of a typed Provider component:

Items to click

  • function MyProvider({ children }: { children: React.ReactNode }) {
  • {children}</MyContext.Provider>; }
  • return <MyContext.Provider value={{ state, dispatch }}>
  • const [state, dispatch] = useReducer(reducer, initialState);

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