hyper input for react
install
npm install --save-dev hyper-input-react style-loader css-loader
webpack.config.js
// add loader
{
test: /\.css$/,
loader: "style-loader!css-loader"
}
import
import HyperInput from 'hyper-input-react'
use
<HyperInput
placeholder='placeholder'
value=''
regExp={this.regExp.bind(this)}
setValue={this.setValue.bind(this)}/>
placeholder: placeholder, optional
value: value, optional
regExp: regExp rules, optional
regExp(value) {
return value.replace(/\s/, '')
}
setValue: the func to get value
setValue(value) {
this.value = value
console.log(value)
}