Created
June 11, 2017 13:17
-
-
Save Louiefigz/e820d84e436c5bd1aa092b82748e87e2 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( | |
this.state.complete ? | |
<div> | |
<li>{this.props.task}</li> | |
Mission complete | |
</div> | |
: | |
<div> | |
<li>{this.props.task}</li> | |
<button onClick={ (event)=> this.handleClick(event) }>complete</button> | |
<br></br> | |
</div> | |
) | |
} | |
} | |
export default Todo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment