flapmap

https://juejin.im/entry/58be21af570c3500622a6a3c

nurx

http://www.jianshu.com/p/0deec21d728f

combinelatest

zip

http://ithelp.ithome.com.tw/articles/10187638?sc=iThomeR

startwith

http://ithelp.ithome.com.tw/articles/10187520?sc=iThomeR

merge

http://ithelp.ithome.com.tw/articles/10187520

scan,buffer

http://ithelp.ithome.com.tw/articles/10187882

 

 

ng cli

https://noreg0092860.gitbooks.io/angular-2/content/ch2_1.html

 

展開運算符理解

interface Todo {
    id:number;
    title:string;
}
interface TodoState {
  todos:Todo[];
  lastUpdate:Date
}
 const INITIAL_TODO_STATE:TodoState={
    todos:[],
    lastUpdate:null
}
const a={...INITIAL_TODO_STATE,todos:[...INITIAL_TODO_STATE.todos,{id:1,title:'shit'}],lastUpdate:new Date()}

const b={...a,todos:[...a.todos,{id:2,title:'sss'}],lastUpdate:new Date()}


const r={a:1,b:2}  /////
const d={...r,b:3}///     會覆蓋

 

這裡

[...state.todos,{
id:state.todos.length+1,
title:payload.title
}]
會變 [{todos},{todos},{todos},{todos}]
 
[state.todos,{
id:state.todos.length+1,
title:payload.title
}]
會變 [[{todo},{todo}],{}]
 
 

 

總而言之,...是個融化的概念

a={1,2}

b={a,3} 會變  {{1,2},3}

c={...a,3} {1,2,3} 

 

 

bug:

yarn add will cause 

spread operator

webpack compile fail 
Property assignment expected


 

 

arrow
arrow
    全站熱搜

    學習程式 發表在 痞客邦 留言(0) 人氣()