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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kazuhito Hokamura
April 19, 2016
Technology
720
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
AAIFに入ってみた ~内から見えるコミュニティ動向~
sato4
0
190
失敗を経て、Harness Engineering で 大切にしたいことを考える / Learning from Failure: What Matters in Harness Engineering
bitkey
PRO
1
360
スキルと MCP ツール、責務をどう分けるか? AI が迷わないインターフェース設計の戦略
cdataj
1
1k
あなたの AI ワークスペースに、 専門コーダーを連れてくる - Amazon Quick Desktop 最新情報
kawaji_scratch
1
130
SONiC Scale-Up Working Group から探る Scale-UpやUltraEthernet機能の実装方法
ebiken
PRO
2
290
データサイエンスを価値につなげるプロジェクト設計 〜 DS一年目が現場で得た気づき 〜
ysd113
1
230
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
130
2026TECHFRESH畢業分享會 - Lightning Talk - 資料也要 CI/CD? 用 Airbyte 自動化資料同步
line_developers_tw
PRO
0
960
【NRUG vol.18】なぜ多くのオブザーバビリティ導入は失敗するのか
nrug_member
0
120
ACE-Step-1.5で見る 音楽生成AIのしくみと“破綻だけ直す”Retake機能の開発【zennfes spring 2026 登壇資料】
personabb
1
380
失敗を資産に変えるClaude Code
shinyasaita
0
640
On-behalf-of Token exchange with AgentCore Identity
hironobuiga
2
170
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.8k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
130
How to Talk to Developers About Accessibility
jct
2
230
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Crafting Experiences
bethany
1
180
HDC tutorial
michielstock
2
710
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
170
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
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.