Slide 13
Slide 13 text
データ取得
localStorage + FetchAPI + useEffectでの取得をしている
https://github.com/oreilly-japan/learning-react-2e-ja/tree/master/chapter-08/8.3
データの管理が複雑なのでデータ取得ライブラリの有用性がわかる
UIの構築に必要な戻り値を持つフックの提供があると楽(data,error,loading,etc...)
末端のコンポーネントでのAPI呼び出し
https://github.com/oreilly-japan/learning-react-2e-ja/tree/master/chapter-08/8.5/8.5.2
親コンポーネントでのデータ取得から分配するパターンを取ることが多いので
表現の違いが見える
unmountされた際の検出とリクエストのキャンセル
https://github.com/oreilly-japan/learning-react-2e-ja/tree/master/chapter-08/8.5/8.5.3
→データ取得を自前で実装することの面倒さを感じる