How to realize the function anti-shaking at this time when the ajax request event is triggered when input input

how to implement the function anti-shake at this time when the ajax request event is triggered when input input

    searchInput(e){
        this.setState({
            searchContent:e.target.value
        })
        fetch(`/api/book/auto-complete?query=${e.target.value}`)
        .then(res=>res.json())
        .then(res=>{
            console.log(res);
            this.setState({
                completionArr:res.keywords
            })
        })
    }
Sep.16,2021

add a timer setTimeout to

searchInput(e){
        this.setState({
            searchContent:e.target.value
        })
        this.timer && clearTimeout(this.timer);
        this.timer = setTimeout(() => {
            fetch(`/api/book/auto-complete?query=${e.target.value}`)
            .then(res=>res.json())
            .then(res=>{
                console.log(res);
                this.setState({
                    completionArr:res.keywords
                })
            })
        }, 500)
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3f55c-2c46e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3f55c-2c46e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?