react-throttle
react-throttle copied to clipboard
children Element can not update
eg:
import React, { useState } from 'react';
import { Debounce } from 'react-throttle';
const Abc = () => { const [count, setCount] = useState(0);
const onSearch = () => {
console.log(1);
}
return (
<div>
<Debounce time="300" handler="onChange">
{count === 0 ? <input
placeholder="请输入"
onChange={onSearch}
/> : <div>1</div>}
</Debounce>
<button onClick={() => setCount(value => value + 1)}>点击</button>
</div>
)
}
when count update, the children element can not update