Y
Y
yumakaev2019-12-22 09:33:00
React
yumakaev, 2019-12-22 09:33:00

How to check if id has changed?

Hello!
I upload data through redax using useEffect, but I get the following in the console:

./src/components/app-promo/app-promo.js
  Line 22:5:  React Hook useEffect has missing dependencies: 'heroesPromoLoaded' and 'promoService'. Either include them or remove the dependency array. If 'heroesPromoLoaded' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps

useEffect:
useEffect(() => {
    const data = promoService.getHeroes();
    heroesPromoLoaded(data);
  }, [promoHeroes.id]);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question