Skip to Content
JavaScriptデザインパターンを学ぶ 第2版
book

JavaScriptデザインパターンを学ぶ 第2版

by Addy Osmani
March 2025
Intermediate to advanced
298 pages
4h 18m
Japanese
O'Reilly Media, Inc.
Content preview from JavaScriptデザインパターンを学ぶ 第2版

第13章. レンダリング・パターン

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

よりインタラクティブなWebサイトに移行するにつれ、 、クライアント側で処理されるイベントの数やレンダリングされるコンテンツの量が増え、React.jsのように主にクライアント側でレンダリングされるSPAが生まれた。

しかし、Webページはその機能に応じて静的にも動的にもなる。例えば、サーバ上で生成し、そのままクライアントにプッシュできるブログやニュースのページだ。静的コンテンツはステートレスで、イベントを発生させず、レンダリング後に水分を補給する必要もない。逆に、動的コンテンツ(ボタン、フィルタリング、検索バー)は、レンダリング後にイベントを再ワイヤリングする必要がある。クライアント側でDOMを再生成しなければならない(仮想DOM)。この再生成、水分補給、イベント処理関数が、クライアントに送信されるJavaScriptに寄与する。

レンダリングパターンは、与えられたユースケースに対してコンテンツをレンダリングするための理想的なソリューションを提供する。この表のレンダリングパターンは一般的なものである:

レンダリングパターン

クライアント側レンダリング(CSR)

HTMLは完全にクライアント上でレンダリングされる。

サーバ側レンダリング(SSR)

サーバでHTMLコンテンツを動的にレンダリングしてから、クライアントでそれを再生成する。

静的レンダリング

静的サイトを構築し、構築時にサーバにページをレンダリングする。

インクリメント静的生成

初期化後も、静的サイトを動的に拡張または修正できる(Next.js ISR、Gatsby DSG)

ストリーミングSSR

サーバでレンダリングされたコンテンツを、より小さなストリームチャンクに分割する。

エッジレンダリング

クライアントに送信する前に、レンダリングされたHTMLをエッジで変更する。

ハイブリッドレンダリング

ビルドタイム、サーバ、クライアントレンダリングを組み合わせて、より柔軟なウェブ開発アプローチを作成する(React Server ComponentsやNext.js App Routerなど)。

部分的な水分補給

コンポーネントの一部だけをクライアントにハイドレートする(React Server ComponentsやGatsbyなど)。

段階的な水分補給

クライアントの水分補給の順番をコントロールする

諸島アーキテクチャ

静的なサイト(アストロ、イレブンティ)において、複数のエントリ点を持つ動的な振る舞いの島が孤立している。

プログレッシブ・エンハンスメント

JavaScriptがなくてもアプリが機能するようにする

この章では、これらのレンダリングパターンのいくつかを紹介し、どのパターンが自分のニーズに最も適しているかを決める手助けをする。この章は、次のような基本的な決定をするのに役立つだろう:

  • コンテンツをどこでどのようにレンダリングしたいのか?

  • コンテンツはウェブサーバ、ビルドサーバ、エッジネットワーク、あるいは直接クライアント上でレンダリングされるべきなのだろうか?

  • コンテンツは一度にレンダリングすべきか、部分的にレンダリングすべきか、段階的にレンダリングすべきか。

レンダリングパターンの重要性

特定のユースケースに最も適したレンダリングパターン( ...

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

アルゴリズムクイックリファレンス 第2版

アルゴリズムクイックリファレンス 第2版

George T. Heineman, Gary Pollice, Stanley Selkow, 黒川 利明, 黒川 洋
Node.jsデザインパターン 第2版

Node.jsデザインパターン 第2版

Mario Casciaro, Luciano Mammino, 武舎 広幸, 阿部 和也

Publisher Resources

ISBN: 9798341625952