第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

redux使用問題

redux使用問題

慕妹3146593 2018-12-20 18:15:21
使用react+redux 登錄成功后用戶信息存在redux中,用axios封裝一個(gè)請(qǐng)求http.js,以后每次請(qǐng)求都帶自動(dòng)帶上登錄成功的token, 如下:import store from '@/redux/store';export const get = (obj) => {let token = store.getState().userRe.token || '';axios({  ...obj,   method: 'get',  url: obj.url,  params: {token},}).then(() => mull).catch(() => null)}我在react-native上這樣使用是沒問題的,但是在react中,http.js引入store則會(huì)以下錯(cuò)誤.Error: Reducer "userRe" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.
查看完整描述

1 回答

?
人到中年有點(diǎn)甜

TA貢獻(xiàn)1895條經(jīng)驗(yàn) 獲得超7個(gè)贊

store.getState() 沒有定義 你看看有沒有g(shù)etState這個(gè)方法


查看完整回答
反對(duì) 回復(fù) 2019-01-23
  • 1 回答
  • 0 關(guān)注
  • 529 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)