TIL: JS 소프트 링크

오늘 나는 배웠다:



👉 JavaScript에서 변수를 다른 배열이나 객체와 동일하게 설정하면 복사본을 만들지 않고 원본을 참조할 새 이름을 만듭니다.

🐧 Linux 용어에서 따와서 저는 이 관행을 soft link (aka symbolic link) 생성이라고 부릅니다.

❇️ 배열이나 객체의 실제 복사본을 만들려면 스프레드 연산자를 사용해야 합니다.

이 지식을 공유해 주신 Thinkful의 Casey Olson에게 감사드립니다.




다음은 Casey와 이야기하기 전에 제가 작성한 원본 문제 해결 문서입니다.

## Problem Solving 
🔎 Situation:
- Using hooks & functional components
- Parent component maintains state
- Multiple child components utilize the parent's state
- When child-A updates the parent's state, I would like child-B to re-render and use the updated state to modify a list in the DOM

🤔💭 Thoughts:
- Seems like this situation is known as 'stale props or state'
  - https://reactjs.org/docs/hooks-faq.html#why-am-i-seeing-stale-props-or-state-inside-my-function

- Seems like a solution may involve using useEffect and useRef
   - https://reactjs.org/docs/hooks-faq.html#is-there-something-like-instance-variables
   - https://reactjs.org/docs/hooks-effect.html

🐉 Obstacle
- I'm not yet familiar enough with useEffect and useRef to implement a solution

🗺️ Plan
- Utilize Thinkful TA Support
- Utilize documentation, articles, and tutorials to better understand useEffect and useRef, so as to implement a quality solution


my fledgling blog에 원래 게시됨

좋은 웹페이지 즐겨찾기