📌  相关文章
📜  immer.js reducer - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:16.909000             🧑  作者: Mango

代码示例1
import produce from "immer"

const byId = produce((draft, action) => {
    switch (action.type) {
        case RECEIVE_PRODUCTS:
            action.products.forEach(product => {
                draft[product.id] = product
            })
    }
}, {})