0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Vue/React メソッド対応表

Last updated at Posted at 2025-02-28

Vue(composition API)とReact(関数型)のメゾッドの共通点を見出したので出力します。

Vue React
通常変数 useRef
ref, reactive useState
computed useMemo
watch useEffect

なぜ通常変数がuseRefになるか

まず、Vueは変数宣言などのコードは一回のみ呼び出すのに対し、Reactは再描画ごとに呼び出します。
つまりReactは全体が別々で呼び出されるため、関数内の変数の値はuseRefなどのフックを使わないと維持できないためです。

また、Vueでは通常変数で宣言した場合それに代入しても再描画はされないためReactのフックは再描画が起こらないuseRefをチョイスしました

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?