Created
June 22, 2017 02:16
-
-
Save rupeshtiwari/c2316d1a1f282496d5d05228ff7d76f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-----COMPLETE_TODO------------ | |
const stateBefore = { | |
todos: [{ text: 'testing', complete: false, path: ['todos', 0] }] | |
}; | |
const stateAfter = { | |
todos: [{ text: 'testing', complete: true, path: ['todos', 0] }] | |
}; | |
const result = over(lensPath(['todos',0, 'complete']), not, stateBefore); | |
console.log(result); | |
///---------ADD_TODO--------- | |
const stateBefore = { | |
todos: [{ text: 'testing' }] | |
}; | |
const stateAfter = { | |
todos: [{ text: 'testing', }, { text: 'testing1' }] | |
}; | |
const result = over(lensPath(['todos']), (todos) => append({text:"testing1"}, todos), stateBefore); | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment