VSCODE debugger stale closures

Поделиться
HTML-код
  • Опубликовано: 20 июн 2024
  • Difference between counter with console.log and rendered display. Console.log lags one behind display state. Use debugger to show why and where the closure is.

Комментарии • 2

  • @dc33333
    @dc33333  5 дней назад

    This is the stale value problem mentioned in Josh's class: courses.joshwcomeau.com/joy-of-react/03-hooks/05.08-stale-values. To fix this add.
    // useEffect(()=>{
    // console.log("useEffect count:",count)
    // },[count])
    But the point of the video is to demo a debug tool for finding closures.

  • @dc33333
    @dc33333  9 дней назад

    Make sure strict mode is off or you will get 2x