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

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

我不明白我們?yōu)槭裁匆约叭绾螌⒁恍〇|西傳遞給這個(gè)函數(shù)。選擇器問(wèn)題

我不明白我們?yōu)槭裁匆约叭绾螌⒁恍〇|西傳遞給這個(gè)函數(shù)。選擇器問(wèn)題

慕無(wú)忌1623718 2022-05-22 13:59:13
在 selectCartItemsCount 中我們似乎沒(méi)有傳遞一些東西,但它以某種方式知道如何設(shè)置 selectCart -----------------------SELECTOR--------------------------    const selectCart = state => state.cart;    export const selectCartItems = createSelector(        [selectCart],        (cart) => cart.cartItems);    export const selectCartItemsCount = createSelector(        [selectCartItems],        cartItems =>        //non serve fare accomulator = ...        //perchè lo fai lui automaticamente la dentro        cartItems.reduce((accomulator, currentItem) => (            accomulator + currentItem.quantity        ), 0)    )    --------------------------CART ICON-----------------------------    const mapStateToProps = (state) => {        return ({            itemCount: selectCartItemsCount(state)        })    }
查看完整描述

1 回答

?
郎朗坤

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

我們使用selectors這樣我們就有能力將第一個(gè)參數(shù)的返回對(duì)象作為第二個(gè)參數(shù)的輸入。所以,它知道它正在傳遞的狀態(tài)(以樹(shù)狀方式,只有它需要的狀態(tài))


 import { createStructuredSelector } from 'reselect'

 const mapStateToProps = createStructuredSelector({

     itemCount: selectCartItemsCount

})


查看完整回答
反對(duì) 回復(fù) 2022-05-22
  • 1 回答
  • 0 關(guān)注
  • 88 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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