Viewのレイヤー構成
● Container/Presentational
データ管理はContainer。データ表示は
Presentational。
● Hook
Container層をスリム化するための共通
APIレイヤー。
useProfile (例)
・onMountedで、APIのget。結果をprofileに格納する。
・setProfile関数で、APIでpatch。DB更新する。
・return { profile, setProfile }
# hookからデータのゲッター、セッターを取得
const { profile, setProfile } = useProfile
# Presentationalにデータを渡す
# 表示する
名前:{{profile.name}}
# 更新する
...
Hook
Container
Presentational