react-throttle icon indicating copy to clipboard operation
react-throttle copied to clipboard

children Element can not update

Open lengxianqu opened this issue 4 years ago • 0 comments

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

lengxianqu avatar Aug 09 '21 08:08 lengxianqu