React HooksとVue Composition APIの違い
React hooks run each time the component renders while the Vue setup function only runs once while creating the component.
React Hooksはコンポーネントがレンダリングされるごとに実行される
Composition APIのsetupはコンポーネント生成時に1度しか呼ばれない
Because React Hooks can run multiple times, there are certain rules the render function must follow, one of them being:> > Don’t call Hooks inside loops, conditions, or nested functions.
React Hooksは複数回呼び出せる
なので、ループ内で呼び出してはいけないというルールがある