zoukankan      html  css  js  c++  java
  • es6 代码片段理解

    代码片段理解:

     1 [INCREMENT]: (state, action) => {
     2     const { payload: { id } } = action
     3 
     4     //because payload contains the id and we already know that we are about
     5     //to increment the value of that id, we modify only that value by one
     6 
     7     return {
     8       ...state,
     9       counters: {
    10         ...state.counters,
    11         [id]: state.counters[id] + 1
    12       }
    13     }
    14   },

    line 2:

    const { payload: { id } } = action
    相当于: id = action.payload.id

    line 8 - 10:

    {
     8       ...state,
     9       counters: {
    10         ...state.counters,
    11         [id]: state.counters[id] + 1
    12       }
    13     }

    是表达:state.counter[id] =  state.counters[id] + 1

    NOI-001—《C++编程及竞赛训练》 NOI-002—《普及组竞赛强化训练课程》 NOI-003—《初级算法课程》
  • 相关阅读:
    资源列表
    资源列表
    编程语言资源列表
    PyTorch简介
    Keras构建回归神经网络
    Keras简介
    Tensorflow之RNN,LSTM
    Tensorflow之CNN
    Tensorflow之dropout
    Tensorflow做分类
  • 原文地址:https://www.cnblogs.com/fphuang/p/6007325.html
Copyright © 2011-2022 走看看