Last active
March 6, 2016 16:31
-
-
Save thatgibbyguy/1983419ed9058a9d0a1d to your computer and use it in GitHub Desktop.
slugifyComponentCaptureValue
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
import React from 'react'; | |
import slugify from 'slugify'; | |
export default React.createClass({ | |
getInitialState() { | |
return { | |
slugifiedString: null, | |
textValue: null, | |
isDisabled: true | |
} | |
}, | |
setTextValue(event) { | |
this.setState( | |
{ | |
textValue: event.target.value, | |
isDisabled: false | |
} | |
); | |
}, | |
render() { | |
let { slugifiedString, | |
textValue, | |
isDisabled } = this.state; | |
return ( | |
<form className="forms forms-inline"> | |
<input type="text" | |
className="width-50" | |
placeholder="What do you want to slugify?" | |
onChange={this.setTextValue} /> | |
<button className="btn" disabled={isDisabled}>Slugify This String</button> | |
</form> | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment