Artwork

Owl Creek Studios에서 제공하는 콘텐츠입니다. 에피소드, 그래픽, 팟캐스트 설명을 포함한 모든 팟캐스트 콘텐츠는 Owl Creek Studios 또는 해당 팟캐스트 플랫폼 파트너가 직접 업로드하고 제공합니다. 누군가가 귀하의 허락 없이 귀하의 저작물을 사용하고 있다고 생각되는 경우 여기에 설명된 절차를 따르실 수 있습니다 https://ko.player.fm/legal.
Player FM -팟 캐스트 앱
Player FM 앱으로 오프라인으로 전환하세요!

React Component Lifecycle, What is a Component?

1:12:51
 
공유
 

Manage episode 316224191 series 2954559
Owl Creek Studios에서 제공하는 콘텐츠입니다. 에피소드, 그래픽, 팟캐스트 설명을 포함한 모든 팟캐스트 콘텐츠는 Owl Creek Studios 또는 해당 팟캐스트 플랫폼 파트너가 직접 업로드하고 제공합니다. 누군가가 귀하의 허락 없이 귀하의 저작물을 사용하고 있다고 생각되는 경우 여기에 설명된 절차를 따르실 수 있습니다 https://ko.player.fm/legal.

We’re always working with components, but do we know when they mount or unmount or even what that actually means? Do we know how effects play into the lifecycle of a component? On this episode, we’re going to take a close look the lifecycle of a React component; what it is made up of and how it interacts with the rest of your program.
Links

Show Notes

  • Intro
  • Overview
  • Background
    • Story about defining a component inside of a component (starts with tests/cypress)
      • React has to check if the definition of a component has changed
    • What actually is a component?
      • Nothing more than a function with bookkeeping
    • Lifecycle
      • Mounting
        • Default state/props
      • Updating
        • Runs function code but doesn’t use default state/props
        • Updates the DOM when complete
          • other than useLayoutEffects
      • Post-Updating / Effects
        • useLayoutEffect, synchronous, after DOM update but before paint
        • Runs hook code sometime after component code completes running and DOM is updated, asynchronous
      • Unmounting
        • Hook cleanup
    • lexical scope
  • Solutions
    • Creating lifecycle methods with useEffect properly
      • useLayoutEffect vs useEffect
      • Dependency array
      • useOnce (similar to onMount)
        • Similar to onMount but different because uses useEffect vs useLayoutEffect
        • useRef - ref.current will be undefined on first run
        • set ref.current to true after running hook code
      • onUnmount
        • AFAIK there is no way to on unmount in a function component
        • But you shouldn’t need to, if you use cleanup effects properly
    • Updating State
      • Prefer updating in event handlers vs useEffect
        • Event handler is more synchronous/easier to reason about
    • Divisions between components/how to divide up your components/hooks
      • Should this influence how we divide up our components?
        • Generally no, abstractions should, not mechanics or performance
  • Tangent: best practices
  • Summary

Support the show

  continue reading

101 에피소드

Artwork
icon공유
 
Manage episode 316224191 series 2954559
Owl Creek Studios에서 제공하는 콘텐츠입니다. 에피소드, 그래픽, 팟캐스트 설명을 포함한 모든 팟캐스트 콘텐츠는 Owl Creek Studios 또는 해당 팟캐스트 플랫폼 파트너가 직접 업로드하고 제공합니다. 누군가가 귀하의 허락 없이 귀하의 저작물을 사용하고 있다고 생각되는 경우 여기에 설명된 절차를 따르실 수 있습니다 https://ko.player.fm/legal.

We’re always working with components, but do we know when they mount or unmount or even what that actually means? Do we know how effects play into the lifecycle of a component? On this episode, we’re going to take a close look the lifecycle of a React component; what it is made up of and how it interacts with the rest of your program.
Links

Show Notes

  • Intro
  • Overview
  • Background
    • Story about defining a component inside of a component (starts with tests/cypress)
      • React has to check if the definition of a component has changed
    • What actually is a component?
      • Nothing more than a function with bookkeeping
    • Lifecycle
      • Mounting
        • Default state/props
      • Updating
        • Runs function code but doesn’t use default state/props
        • Updates the DOM when complete
          • other than useLayoutEffects
      • Post-Updating / Effects
        • useLayoutEffect, synchronous, after DOM update but before paint
        • Runs hook code sometime after component code completes running and DOM is updated, asynchronous
      • Unmounting
        • Hook cleanup
    • lexical scope
  • Solutions
    • Creating lifecycle methods with useEffect properly
      • useLayoutEffect vs useEffect
      • Dependency array
      • useOnce (similar to onMount)
        • Similar to onMount but different because uses useEffect vs useLayoutEffect
        • useRef - ref.current will be undefined on first run
        • set ref.current to true after running hook code
      • onUnmount
        • AFAIK there is no way to on unmount in a function component
        • But you shouldn’t need to, if you use cleanup effects properly
    • Updating State
      • Prefer updating in event handlers vs useEffect
        • Event handler is more synchronous/easier to reason about
    • Divisions between components/how to divide up your components/hooks
      • Should this influence how we divide up our components?
        • Generally no, abstractions should, not mechanics or performance
  • Tangent: best practices
  • Summary

Support the show

  continue reading

101 에피소드

Усі епізоди

×
 
Loading …

플레이어 FM에 오신것을 환영합니다!

플레이어 FM은 웹에서 고품질 팟캐스트를 검색하여 지금 바로 즐길 수 있도록 합니다. 최고의 팟캐스트 앱이며 Android, iPhone 및 웹에서도 작동합니다. 장치 간 구독 동기화를 위해 가입하세요.

 

빠른 참조 가이드

탐색하는 동안 이 프로그램을 들어보세요.
재생