Created
June 11, 2017 16:44
-
-
Save Louiefigz/12d3861dbd653e712ea8f5a9ab0d9702 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
import React from 'react'; | |
class Todo extends React.Component{ | |
constructor(){ | |
super(); | |
this.state={ | |
complete: false | |
} | |
} | |
handleClick(e){ | |
e.preventDefault(); | |
this.setState({ | |
complete: true | |
}) | |
} | |
render(){ | |
return( | |
<div> | |
<li>{this.props.task}</li> | |
{this.state.complete ? undefined : <button onClick={ (event)=> this.handleClick(event) }>complete</button>} | |
<br></br> | |
{this.state.complete ? "complete" : "mission not complete"} | |
</div> | |
) | |
} | |
} | |
export default Todo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment