📅  最后修改于: 2022-03-11 15:04:16.909000             🧑  作者: Mango
import produce from "immer"
const byId = produce((draft, action) => {
switch (action.type) {
case RECEIVE_PRODUCTS:
action.products.forEach(product => {
draft[product.id] = product
})
}
}, {})