摘要: function useContext(context){ console.log(context._currentValue) return context._currentValue; } let CounterContext = React.createContext(); function  阅读全文
posted @ 2020-10-21 20:08 国服第一李师师 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 其实useReducer和useState有点相似,useState之前介绍过是useReducer的语法糖。 我们看两个code useEffect(() => { console.log(a) timerID.current = setInterval(()=>{ setCount(count  阅读全文
posted @ 2020-10-21 19:41 国服第一李师师 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 这个图是我 之前犯了错误好久没注意,今天终于忍不住去查了下,原来就是因为state里面的一个数据人家开始是{},而我去给人家赋值成了数组 阅读全文
posted @ 2020-10-21 13:59 国服第一李师师 阅读(1505) 评论(0) 推荐(1) 编辑