HI,
I want to show notification count.in useeffect only i can show that.but useeffect make function slow. how can i use callback when the state change.
const [data, setData] = useState([]);
const [filteredDataSource, setFilteredDataSource] = useState([]);
useEffect(()=>{
getData({});
notify();
},[filteredDataSource]);
const notify = useCallback(() => {
}, [filteredDataSource])
const getData = async () => {
axios
.get(url, {
})
.then(({data}) => {
setData(data['0'].NotificationCount);
setFilteredDataSource(data);
});
};