Answer the question
In order to leave comments, you need to log in
How to fix warning?
React Hook useEffect has a missing dependency: 'loadUsingHistory'. Either include it or remove the dependency array react-hooks/exhaustive-deps
useEffect(() => {
loadUsingHistory();
}, []);
const loadUsingHistory = () => {
if (id && !isNaN(+id)) {
contract
.getContractHistoryStatus(+id)
.then((response) => {
return response.data.map((item: any) => {
return {
...item,
key: item.id,
};
});
})
.then((response) => {
setData(response);
});
}
};
...
<Button icon={<SyncOutlined />} onClick={loadUsingHistory}>
Обновить
</Button>
Answer the question
In order to leave comments, you need to log in
const loadUsingHistory = useCallback(() => {
...
}, [id, setData]);
useEffect(() => {
loadUsingHistory();
}, [loadUsingHistory]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question