N
N
Nikita Ronzin2021-02-17 12:39:06
React
Nikita Ronzin, 2021-02-17 12:39:06

Why can't you pass parameters to callBack useeffect?

On the review code, I was told that the arguments to the callback function passed to useeffect cannot be passed. You need to do it outside of the hook. Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Suntsev, 2021-02-17
@Ababinili

Let's break down the useEffect hook

useeffect(() => {
    action(object) // собственно вызов этих методов
}, [action, object]) // объекты и методы, которые вы используете внутри коллбэка

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question