본문 바로가기
Study

[article] Top 7 mistakes that React developers make

by 안자두 2023. 3. 11.

🌞 Article

👇 link

https://javascript.plainenglish.io/4-react-tips-to-instantly-improve-your-code-7456e028cfa3

 

4 React Tips to Instantly Improve Your Code

Solid knowledge of React is one of the most valuable skills for a frontend developer. Many companies are constantly searching for React…

javascript.plainenglish.io

 


💬 정리하기

흔히, React 초보자들이 할 수 있는 7가지 실수에 대한 글이다.

7가지를 나열해 보면,

  • 모든 것을 하나의 파일에 넣는 것
  • 상태 직접 수정
  • 컴포넌트의 구성 요소는 숫자가 될 수 있지만 받을 땐 문자열로 받는 것
  • setState()가 비동기임을 잊는 것
  • 구성 요소의 첫 문자를 대문자로 하지 않는 것
  • 알아보기 힘든 폴더 구조
  • god components를 사용하는 것

이 있다.

나도 가끔 setState()가 비동기임을 잊곤 해, 뜨끔했던😅

god components는 처음 보는 용어였는데, 찾아보니 정말 god '신'처럼 모든 것을 포함하는 component를 말한다.
앱의 상호 연결된 여러 부분을 하나로 묶는 것이 아닌, 자체 구성 요소로 만들어야 한다. 이러한 방식으로 구성 요소를 분리하면 앱의 모든 부분을 더 쉽게 유지 관리하고 필요할 때 재구성할 수 있다.
이처럼 하지 않는 god components는 안티 패턴이며 유지 보수에도 어려움을 준다.

이 용어는 components에 국한된 것이 아닌, god object, god class 등 비슷한 맥락에서 사용할 때 주로 god을 붙이는 것 같다. 위키피디아에서 god object에 대한 글을 볼 수 있다.

 

관련하여 찾아보니 비슷한 글들이 꽤나 많았다 (무엇이 먼저였는지 모를 정도로 비슷한 것들도...).
간혹 잊게 되는 것들을 상기시킬 수 있었던 글이었다.👀

비슷했던 글들👇

https://www.educative.io/blog/top-react-mistakes

 

Top 10 mistakes to avoid when using React

React is the most popular front-end framework in the tech world, used by top companies like Facebook, Netflix, and Airbnb. Learn more about the top mistakes React developers make - and how to fix them.

www.educative.io

https://www.tiny.cloud/blog/six-common-mistakes-to-avoid-when-using-react/

 

Six common mistakes to avoid when using React

React is an excellent JavaScript library for building user interfaces. However, if you don't use React properly, you could end up creating more problems than you solve. So, here are six common mistakes to avoid when using React.

www.tiny.cloud

 

728x90