Created
February 16, 2016 23:15
-
-
Save laere/aabe39e8f8c0c6a86b6c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
///Click func | |
handleOnClick(e) { | |
e.preventDefault(); | |
//save input value | |
let inputValue = this.refs.inputfield.value; | |
if(inputValue === '') return; | |
//pass input value to callback | |
this.props.addTodo(inputValue) | |
} | |
//Callback within click func that calls addtodo action creator | |
addTodo(text) { | |
//add to do | |
this.props.AddTodo(text) | |
.then(() => { | |
updateState() | |
}) | |
.catch(() => { | |
updateState(); | |
}) | |
console.log('This is the text passed to the AddTodo AC: ' + text); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment