react-slug
v0.1.2
Published
A component for entering a url-friendly slug
Downloads
9
Readme
##React Slug
##Install
npm install react-slug
##Example
It acts exactly the same as a regular input, the onChange will return the event as a second parameter.
import React from 'react'
import Slug from 'react-slug'
export default class App extends React.Component{
constructor(){
super()
this.handleChange = this.handleChange.bind(this)
}
handleChange(event){
console.log(event.target.value)
}
render(){
return <Slug value="this will be stringified" onChange={this.handleChange} className="test" />
}
}
###Rebuilding
Run this to view the example in example/dist
npm run build
###Description
This is a super simple react component that will strip any non alpha-numeric characters for you. It will turn spaces into hyphens. Thanks to Jed Watson for the gulpfile stuff ;)