import React from 'react';
import DelayKeypress from 'delay-keypress';
class Example extends React.Component{
//If the key is re-entered within 0.5 seconds, it will not be executed.
//It runs if there is no input for 0.5 seconds.
onChange =(value)=>{
//delay 0.5s
console.log(value)
}
render(){
return(
<input type="text" onChange={DelayKeypress(this.onChange, 500)}>
)
}
}
import React from 'react';
import DelayKeypress from 'delay-keypress';
class Example extends React.Component{
//0.5초안에 입력되면 호출되지 않습니다.
//0.5초가 지나면 호출됩니다.
onChange =(value)=>{
//delay 0.5s
console.log(value)
}
render(){
return(
<input type="text" onChange={DelayKeypress(this.onChange, 500)}>
)
}
}