Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[๐Ÿ”ง Front-End Error] #6 / useEffect has a missing dependency / 2021-09-29 #265

Open
youngseo-kangg opened this issue Sep 29, 2021 · 0 comments
Assignees
Labels
Error Error Front-End Front-End Tasks
Milestone

Comments

@youngseo-kangg
Copy link
Collaborator

์–ด๋–ค ์—๋Ÿฌ์ธ๊ฐ€์š”?

  • useEffect๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปดํฌ๋„ŒํŠธ๊ฐ€ mount ๋์„๋•Œ ์‹คํ–‰๋˜๋„๋ก ๋นˆ ์ข…์†๋ฐฐ์—ด์„ ์กฐ๊ฑด์œผ๋กœ ๋‘๊ณ  ์ž‘์—…ํ•˜๊ณ  ์žˆ์„ ๋•Œ ๋ณด๊ฒŒ ๋˜์—ˆ์Œ
  • history๋ผ๋Š” ๋ณ€์ˆ˜ ์•ˆ์— useHistory()์‹คํ–‰์„ ๋‹ด์•„๋‘๊ณ  ์žˆ๊ณ , history ๋ณ€์ˆ˜๋ฅผ useEffect ์•ˆ์—์„œ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์—ˆ์Œ
  • ์—๋Ÿฌ๋Š” ์•„๋‹ˆ์˜€์ง€๋งŒ, ๊ณตํ†ต์ ์œผ๋กœ ์ž์ฃผ ๋“ฑ์žฅํ•˜๊ณ  ์žˆ์–ด์„œ ํ•ด๊ฒฐ ๋ฐฉ์•ˆ์ด ํ•„์š”ํ•˜๋‹ค๊ณ  ๋Š๊ผˆ์Œ

์—๋Ÿฌ ๋ฉ”์‹œ์ง€

  • React Hook useEffect has a missing dependency: 'history'. Either include it or remove the dependency array

์—๋Ÿฌ ํ•ธ๋“ค๋ง ๋ฐฉ๋ฒ•

  • useEffect ์™ธ๋ถ€์— ํ•จ์ˆ˜๋ฅผ ์ •์˜ํ•˜๊ณ  useEffect ๋‚ด์—์„œ ์‹คํ–‰์‹œํ‚ฌ ๋•Œ, ํ•จ์ˆ˜๋„ ์ข…์† ๋ฐฐ์—ด์— ๋„ฃ์–ด์ค˜์•ผ ํ•จ
  • ์ •์˜ํ•œ ํ•จ์ˆ˜๋ฅผ ์ข…์† ๋ฐฐ์—ด์•ˆ์— ๋„ฃ์–ด์ฃผ๋ฉด ํ•ด๋‹น warning์€ ์‚ฌ๋ผ์ง
    • ์‹คํ–‰์— ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š”๊ฑด ์•„๋‹ˆ๋ผ์„œ, prettier ๋˜๋Š” eslint๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ warning์„ ํ•ด์ œํ•ด๋„ ๊ดœ์ฐฎ๋‹ค๊ณ  ํ•˜๋Š”๋ฐ useEffect ์ข…์†๋ฐฐ์—ด ์•ˆ์— ๋„ฃ์–ด์ฃผ๋Š”๊ฒŒ ๋งˆ์Œ์ด ๋” ํŽธํ•œ๊ฑฐ ๊ฐ™๊ธด ํ•˜๋‹ค
    • const aFunction = () => {~~~} / useEffect(()=>{ aFunction() }, [aFunction])

์—๋Ÿฌ ํ•ธ๋“ค๋ง์„ ์œ„ํ•ด ์ฐธ๊ณ ํ•œ ๋ ˆํผ๋Ÿฐ์Šค ๋งํฌ

React Hook useEffect has a missing dependency: 'dispatch'
[React ์˜ค๋ฅ˜] React Hook useEffect has a missing dependency: ' '. Either include it or remove the dependency array react-hooks/exhaustive-deps

@youngseo-kangg youngseo-kangg added Front-End Front-End Tasks Error Error labels Sep 29, 2021
@youngseo-kangg youngseo-kangg added this to the Advanced milestone Sep 29, 2021
@minjman2659 minjman2659 changed the title [๐Ÿ”ง Front-End Error] #5 / useEffect has a missing dependency / 2021-09-29 [๐Ÿ”ง Front-End Error] #6 / useEffect has a missing dependency / 2021-09-29 Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Error Front-End Front-End Tasks
Projects
None yet
Development

No branches or pull requests

2 participants