1.0.2 • Published 1 year ago

softobiz-lazy-input v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Softobiz-Lazy-Input

This componet can be used as a search input comopnent where you want to optimize your serach api calls. Its takes a callback function which is get triggered when stop typing on in it.

Installation

npm install softobiz-lazy-input

Usage

In the browser

import { useState } from "react";
import { LazyInput } from "softobiz-lazy-input";

function App() {
    const [value, setValue] = useState("");

    const handleLazyChange = () => {
        // you can write your code or api calls here
        console.log(value);
    };
    return (
        <div>
            <LazyInput
                value={value}
                onChange={(e) => setValue(e.target.value)}
                onLazyChange={handleLazyChange}
                delay={500}
            />
        </div>
    );
}

const root = createRoot(document.getElementById("root"));
root.render(<App />);

Caveats

Required React Version

React 16.8 or above is required because we use hooks .

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago