Skip to Content
流暢なReact
book

流暢なReact

by Tejas Kumar
March 2025
Beginner to intermediate
336 pages
5h 1m
Japanese
O'Reilly Media, Inc.
Audio summary available
Content preview from 流暢なReact

第10章. Reactの代替案

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

前の章では、React Server Components(RSC)という新たなトピックを深く取り上げた。RSCがどのように機能するのか、どのような場合に使用するのか、そしてなぜ次世代バンドルラーやルーターなどの強力なツールが必要なのかを探った。さらに、サーバ・コンポーネントとサーバ・レンダリングを区別し、基本的なメカニズムを理解するために、ゼロからRSCsレンダラーを実装した。

Reactに代わる選択肢を探るにあたり、フレームワークとサーバコンポーネントの役割と機能を理解することは、貴重な文脈を提供することになる。この章で説明する各ライブラリには、関連するフレームワークも同梱されており、Reactで説明した原則やトレードオフの多くは、これらのエコシステムにも適用される。

Reactとそのエコシステムから目をそらし、フロントエンド開発のエコシステムで人気のある代替案を掘り下げてみよう:Vue.js、Angular、Svelte、Solid、Qwikだ。Vue.js、Angular、Svelte、Solid、Qwikだ。それぞれのライブラリやフレームワークは、独自のリアクティビティ・モデルやUI開発に対する考え方を導入している。これらの異なるモデルを理解することで、視野が広がり、プロジェクトの問題を解決するツールが増える。

Vue.js

Vue.js Vue.jsは、ユーザインタフェースを構築するための人気のあるJavaScriptフレームワークである。AngularJSのプロジェクトに携わっていた元GoogleエンジニアのEvan Youによって開発されたVue.jsは、Angularの良い部分を抽出し、より軽量で保守しやすく、意見の少ないパッケージを目指している。

Vueの最も特徴的な機能のひとつに、控えめなリアクティブ・システムがある。コンポーネントの状態 は、リアクティブなJavaScriptオブジェクトで構成されている。それらを変更すると、ビューが更新される。これによって状態管理がシンプルで直感的になるが、よくあるゴチャゴチャを避けるためには、その仕組みを理解することも重要だ。

Vueのリアクティブ・モデルでは、オブジェクト・プロパティの読み取りと書き込みをインターセプトする。Vue 2では、ブラウザサポートの制限からゲッター/セッターのみを使用していたが、Vue 3では、リアクティブオブジェクトにはプロキシが使用され、refにはゲッター/セッターが使用される。Vueのドキュメントから、これらがどのように機能するかを示す擬似コードを紹介しよう:

function reactive(obj) {
  return new Proxy(obj, {
    get(target, key) {
      track(target, key)
      return target[key]
    },
    set(target, key, value) {
      target[key] = value
      trigger(target, key)
    }
  })
}

function ref(value) {
  const refObject = {
    get value() {
      track(refObject, 'value')
      return value
    },
    set value(newValue) {
      value = newValue
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

ウェブ・アクセシビリティ・クックブック

ウェブ・アクセシビリティ・クックブック

Manuel Matuzovic

Publisher Resources

ISBN: 9798341624689