Either include them or remove the dependency array Ошибка. Что если эти зависимости не нужны
Primary tabs
Без строчки // eslint-disable-next-line получаем предупреждение:
React Hook React.useEffect has missing dependencies: 'history.location.search' and 'match.params'. Either include them or remove the dependency array react-hooks/exhaustive-deps
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
для кода:
React.useEffect(() => { // обработка изначального фильтра
console.log(' match.params', match.params);
const params = queryString.parse(history.location.search);
let initFilterValue: string | null = null;
let filerValue = params[filterParamName];
if ((typeof filerValue === 'string')) {
initFilterValue = filerValue;
}
if (initFilterValue) {
dispatch(filterByName(initFilterValue));
}
},
// eslint-disable-next-line
[dispatch]
);
-- по задаче этот эффект должен выполнится только 1 раз.
Вопрос
Уместно ли использование такого комментария в данном случае -или нужно действовать как-то ещё?
- Log in to post comments
- 1785 reads