Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
relay
Search
Kazuhito Hokamura
April 19, 2016
Technology
710
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
relay
Kazuhito Hokamura
April 19, 2016
More Decks by Kazuhito Hokamura
See All by Kazuhito Hokamura
TypeScriptとGraphQLで実現する 型安全なAPI実装 / TSKaigi 2024
hokaccha
5
5.1k
Kotlin製のGraphQLサーバーをNode.jsでモジュラモノリス化している話
hokaccha
0
3.8k
GraphQLの負債と向き合うためにやっていること
hokaccha
2
1.6k
ユビーのアーキテクチャに対する取り組み
hokaccha
1
490
RailsエンジニアのためのNext.js入門
hokaccha
7
22k
Cookpad Summer Internship 2021 Web Frontend
hokaccha
0
7.4k
巨大なモノリシック Rails アプリケーションの マイクロサービス化戦略 / 2019 microservices in cookpad
hokaccha
3
4.1k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
1.1k
Web Frontend Improvement in Cookpad
hokaccha
1
1.2k
Other Decks in Technology
See All in Technology
EventBridge Connection
_kensh
4
520
Databricks における 生成AIガバナンスの実践
taka_aki
1
310
2026.06.13_AI時代に事業会社が「SIer出身エンジニア」を求める理由 / Why Businesses Seek Engineers with a System Integrator Background in the AI Era
jumtech
0
500
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
1.9k
はじめてのDatadog
kairim0
0
280
「コーディング」しない人のための Claude Code 入門 ChatGPT の次の一歩 — 業務に組み込む 育成・共有・自動化
rfdnxbro
2
1.2k
速さだけじゃない! VoidZero ツールが移行先に選ばれる理由
mizdra
PRO
6
750
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
50k
形式手法特論:公平性制約の位相的特徴づけ #kernelvm / Kernel VM Study Kansai 12th
ytaka23
1
750
OCI Oracle AI Database Services新機能アップデート(2026/03-2026/05)
oracle4engineer
PRO
0
220
10倍の生産性を実現するAI駆動並列エージェントのすべて
kumaiu
2
280
そのPoC、何を検証したつもりでしたか? AIプロダクトの価値検証で陥った落とし穴
techtekt
PRO
0
150
Featured
See All Featured
For a Future-Friendly Web
brad_frost
183
10k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
570
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
300
Skip the Path - Find Your Career Trail
mkilby
1
140
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Git: the NoSQL Database
bkeepers
PRO
432
67k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Abbi's Birthday
coloredviolet
2
7.9k
Claude Code のすすめ
schroneko
67
230k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
320
Speed Design
sergeychernyshev
33
1.8k
Transcript
Relay Meguro.es #3
@hokaccha
Relay
React
GraphQL
None
GraphQL
GraphQLͱ • Facebook͕։ൃͨ͠ΫΤϦݴޠ • ΫϥΠΞϯτ/αʔόʔؒͷΓऔΓʹΘΕΔ • RESTRPCͱൺֱ͞ΕΔ
http://example.com/products/1 { "id": 1, "name": "foo", "description": "..." "image": {
"uri": "http://...", "width": 120, "height": 120 } }
http://example.com/graphql { "product" : { "id": 1, "name": "foo", "description":
"..." "image": { "uri": "http://...", "width": 120, "height": 120 } } } { product(id: 1) { id, name, description, image(size: 120) { uri, width, height } } } 3FRVFTU 3FTQPOTF
ଓ͖WebͰ http://graphql.org/
Relay
A JavaScript framework for building data-driven React Applications
ैདྷͷख๏ 1. Πϕϯτ͕τϦΨʔ͞ΕΔ 2. αʔόʔʹϦΫΤετ͢Δ 3. ϨεϙϯεΛݩʹViewΛ࠶ߏங͢Δ
$el.find('.select').on('selectProduct', id => { fetch(`/products/${id}`).then(product => { $('.name').text(product.name); $('.description').text(product.description); });
});
ReactΛͬͨ߹ 1. Πϕϯτ͕τϦΨʔ͞ΕΔ 2. αʔόʔʹϦΫΤετ͢Δ 3. ϨεϙϯεͷσʔλΛݩʹstateΛߋ৽͢Δ • ࣗಈͰView͕ߋ৽͞ΕΔ
class AppComponent extends React.Component { handleSelect(id) { fetch(`/products/{id}`).then(product => {
// update state }); } render() { return ( let { name, description } = this.props.app.product; <div> <ProductSelect onSelect={id => this.handleSelect(id)} /> <h1>{name}</h1> <div>{description}</div> </div> ); } } ໋ྩత એݴత
RelayΛͬͨ߹ 1. Πϕϯτ͕τϦΨʔ͞ΕΔ 2. ϦΫΤετΛͭ͘ΔͨΊͷΛߋ৽͢Δ • ࣗಈͰϦΫΤετΛૹΔ • ϨεϙϯεͷσʔλΛݩʹstateΛࣗಈͰߋ৽ •
View͕ࣗಈతʹߋ৽͞ΕΔ
class AppComponent extends React.Component { handleSelect(id) { this.props.relay.setVariables({ id });
} render() { let { name, description } = this.props.app.product; return ( // Reactͷྫͱಉ༷ ); } } const AppContainer = Relay.createContainer(AppComponent, { initialVariables: { id: 1 }, fragments: { app: () => Relay.QL` fragment on App { product(id: $id) { name, description } } `, }, }); એݴత
ଞʹɾɾɾ • ΫΤϦͷߏԽ • ΫΤϦͷ੩తܕνΣοΫ • σʔλͷߋ৽ • ϩʔσΟϯάͷ੍ޚ •
Ωϟογϡ • ϖʔδωʔγϣϯ • ͳͲͳͲΓͩ͘͞Μ
RelayͷͭΒ͍ͱ͜Ζ
• GraphQL/Reactͷ͕ࣝલఏ • babelΛͬͨϏϧυڥඞਢ • React΄ͲγϯϓϧͰͳ͍ • ͪΐͬͱࢼ͚ͩ͢Ͱෑډߴ͍ • ݱ࣌ͰࢿྉࢀߟΞϓϦ͕ઈతʹগͳ͍
fin.