Skip to content

ivanwolf/react-after-typing

Repository files navigation

react-after-typing

This HOC add a callback function to an input component. The function is called right after the user stop typing.

What it solves

Some uses case are instant form validation and applying a filter to a list.

Usage

$ yarn add react-after-typing
import afterTyping from 'react-after-typing':

// Define your input
const Input = props => (
  <input type="text" {...props} />
);

// Enhance it
const InputWithCallback = afterTyping(Input);
// Add the callback prop
render() {
  return (
    <InputWithCallback afterTyping={() => console.log('Hola')}/>
  )
}

< EnhancedInput />

Props

  • afterTyping: Function

    The the function to be called.

  • time: Integer

    Optional. Number of ms waited before firing the function, defaults to 500.

About

Do something right after user stop typing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published