useContext() returns undefined

前端 未结 1 1935
傲寒
傲寒 2021-01-21 16:52

I\'m running into an issue which is super frustrating and I can\'t figure out whats going on. I have a simple context as shown here:

import React, { useState, cr         


        
相关标签:
1条回答
  • 2021-01-21 17:26

    You are importing AppStateContextProvider

    change import AppStateContext from "../contexts/AppStateContext";

    to import { AppStateContext } from "../contexts/AppStateContext";

    0 讨论(0)
提交回复
热议问题