Concise explanation. Simple to grasp. Thanks a bunch for the article. One quick question though.
Why does esLint give a warning whenever i use a variable defined outside, inside the effect without passing it as a dependency. Like:
url is defined outside and obviously i want to fetch the data once after initial render but esLint gives a warning requiring me to pass it as a dependency. Does it mean i can't use a variable defined outside the effect if i don't pass it as a dependency?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Concise explanation. Simple to grasp. Thanks a bunch for the article. One quick question though.
Why does
esLint
give a warning whenever i use a variable defined outside, inside theeffect
without passing it as a dependency. Like:url
is defined outside and obviously i want to fetch the data once after initial render butesLint
gives a warning requiring me to pass it as a dependency. Does it mean i can't use a variable defined outsidethe effect
if i don't pass it as a dependency?