Skip to content

Instantly share code, notes, and snippets.

@laere
Created February 16, 2016 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laere/aabe39e8f8c0c6a86b6c to your computer and use it in GitHub Desktop.
Save laere/aabe39e8f8c0c6a86b6c to your computer and use it in GitHub Desktop.
///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