1.0.0 • Published 5 years ago
react-components-encoded v1.0.0
react-components-encoded
A lib of components i commonly re-use in my projects
Install
npm install --save react-components-encoded
Usage
DelayedInput
Delay the call to onChange as long as user is typing or delay ends
import React, { useState, useEffect } from 'react'
import { DelayedInput } from 'react-components-encoded'
export default function DelayedInputExample() {
const [value, setValue] = useState('')
useEffect(() => {
console.log(`Value has changed to ${value} !`)
}, [value])
return (
<div>
<label htmlFor="demo-delayed-input">DelayedInput </label>
<DelayedInput
id="demo-delayed-input"
onChange={setValue}
// value={value} // optional default is an empty string
// delay = 1000 // optional, Delay in ms default is 750
// type = "range" // optional default is "text"
// all other props are passed down to the jsx input element
/>
</div>
)
}
License
GNU GPLv3 © Encoded77
1.0.0
5 years ago