タグ

2024年7月11日のブックマーク (2件)

  • Naming things needn’t be hard

    Naming things needn’t be hard Find inspiration for naming things – be that HTML classes, CSS properties or JavaScript functions – using these lists of useful words. Word lists Action Describe the behaviour or operation of things. Collection Describe the containment and grouping of things. Comparison Describe the equivalent likeness between things. Numeration Describe the order, precedence and mult

    Naming things needn’t be hard
  • 結局 useEffect はいつ使えばいいのか

    useEffectはReactの中でも扱いの難しいフックとして知られています。Reactで開発を行う中でuseEffectを検討するタイミングや適切な使い方について悩んだ経験のある方も多いのではないでしょうか。 記事では、useEffectの目的を把握し、どのような場合にuseEffectの使用を検討すべきかについて考えていきたいと思います。 コンポーネントの純粋性と副作用 まずuseEffectについて考える前に、コンポーネントの純粋性について理解する必要があります。Reactにおいて純粋性は重要な概念の1つです。 前提として、Reactではすべてのコンポーネントが純関数あることを仮定しています。 Reactは、あなたが書くすべてのコンポーネントが純関数であると仮定しています。 参照:https://ja.react.dev/learn/keeping-components-pure#

    結局 useEffect はいつ使えばいいのか
    jay-es
    jay-es 2024/07/11
    エフェクトは、特定のイベントではなくレンダー自体によって引き起こされる副作用。useEffect はレンダリングとエフェクトを分離し、レンダー結果が画面に反映されるまでコードの実行を遅らせる