Skip to content

Instantly share code, notes, and snippets.

@thatgibbyguy
Last active March 6, 2016 16:31
Show Gist options
  • Save thatgibbyguy/1983419ed9058a9d0a1d to your computer and use it in GitHub Desktop.
Save thatgibbyguy/1983419ed9058a9d0a1d to your computer and use it in GitHub Desktop.
slugifyComponentCaptureValue
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