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
バックエンドエンジニアから見たReact #react_fukuoka
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Transnano
June 05, 2019
Technology
2
130
バックエンドエンジニアから見たReact #react_fukuoka
バックエンドエンジニアがReactに入門する際に敷居を下げるための発表資料
Transnano
June 05, 2019
Tweet
Share
More Decks by Transnano
See All by Transnano
ヤフーのデータ入出稿を支えるSRE
transnano
0
650
2019/07/11 ふくばねてす node-2 コンテナ移行におけるアレコレと使えるアレコレ(仮)
transnano
0
450
Consulって何だろう
transnano
0
120
PrometheusExporterを作ってみた+α
transnano
0
270
Other Decks in Technology
See All in Technology
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
240
Ruby版 JSXのRuxが気になる
sansantech
PRO
0
170
GitHub Issue Templates + Coding Agentで簡単みんなでIaC/Easy IaC for Everyone with GitHub Issue Templates + Coding Agent
aeonpeople
1
260
OpenShiftでllm-dを動かそう!
jpishikawa
0
140
ECS障害を例に学ぶ、インシデント対応に備えたAIエージェントの育て方 / How to develop AI agents for incident response with ECS outage
iselegant
4
420
SRE Enabling戦記 - 急成長する組織にSREを浸透させる戦いの歴史
markie1009
0
170
Kiro IDEのドキュメントを全部読んだので地味だけどちょっと嬉しい機能を紹介する
khmoryz
0
210
ファインディの横断SREがTakumi byGMOと取り組む、セキュリティと開発スピードの両立
rvirus0817
1
1.7k
AIエージェントに必要なのはデータではなく文脈だった/ai-agent-context-graph-mybest
jonnojun
1
250
コンテナセキュリティの最新事情 ~ 2026年版 ~
kyohmizu
6
2.3k
10Xにおける品質保証活動の全体像と改善 #no_more_wait_for_test
nihonbuson
PRO
2
340
GitHub Copilot CLI を使いやすくしよう
tsubakimoto_s
0
110
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
14k
The browser strikes back
jonoalderson
0
420
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
53
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
KATA
mclloyd
PRO
34
15k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
70
Prompt Engineering for Job Search
mfonobong
0
160
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
120
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
440
Transcript
バックエンドエンジニアか ら見たReact Ryota Suginaga
Agenda • Self-introduction • Back-end engineer worries • Want to
create a small web-app • My understanding of React • React beyond my understanding • Work efficiency tool • Summary 話さないこと • 他ライブラリやフレームワークとの比較 • Reactの機能詳細
Self-introduction 杉永良太(@transnano) ヤフー株式会社 バックエンドエンジニア(SRE) YAML > Shell > (超えられない壁) >
TypeScript > Ruby, Python, Perl, Java 以前:業務システム・アプリ、Java > C# > JavaScript 興味:クラウドネイティブ、Go > React (Reactについての理解が間違っていたら優しく教えてください)
Anai OMG!!
Back-end engineer worries CLIとかWebAPI、監視は得意 CUI(CLI)でもいいけど、GUI(Web)の方がやっぱり便利! ⇒Webアプリならインストールも要らないしね ⇒Push->デプロイの自動化・運用は任せて〜
Want to create a small web-app バックエンドAPIは秒で作るから、結果を表示する部分だけ作れれば。。。 ⇒そう、Reactならね
Try to start sample react-app $ npm i -g create-react-app
$ create-react-app myapp $ cd myapp $ yarn start
My understanding of React • React = Viewライブラリ ◦ 見た目の部分がやりたいから、今回の要件に合いそう
• component = class、state = instance variable、property = initialize value ◦ Java脳には理解しやすく、書きやすかった(後述) • Component Life-cycle ◦ これのおかげでビューの扱いが超絶簡単になっている(後述) • Styled component ◦ デザインとロジックをまとめられる、部品化しやすい、変数化されていたりもして改造できる ◦ Material-UIがあればコピペでビューができる
Compare React and Java class Parent extends React.Component { static
propTypes = { name: PropTypes.string.isRequired, age: PropTypes.int.isRequired, }; // コンストラクタで初期値をセット constructor(props) { super(props); // stateの初期値を設定 this.state = { name: this.props.name, age: this.props.age, }; } } class Human { String name; int age; // コンストラクタで初期値をセット Human(String name, int age) { super(); // クラス変数の初期値を設定 this.name = name; this.age = age; } }
Component life-cycle • componentDidMount() ◦ DOM構築後に走るイベントなので、ここで初回の API通信したり • componentDidUpdate(prevProps, prevState,
snapshot) ◦ propertyまたはstateが変わった時なので、 2回目以降のAPI通信したり ◦ prevPropsが前回の値でthis.propsが現在の値として比較可能 • componentWillUnmount() ◦ コンポーネントが使われなくなる時なので、終了処理したり • shouldComponentUpdate(nextProps, nextState) ◦ コンポーネントを再描画すべきかどうかの判定処理を入れたり
Next challenges • TypeScript(TSX) ◦ TSXだとProperty以外も型までしっかりと書けるため • SSR ◦ サーバサイドでもReactが使える嬉しい機能。
BFFやる時までには習得したい • Hooks ◦ Reactの新しい概念・機能で、簡潔に書ける /テストしやすくなるため
Work efficiency tool <画像を貼る> 1. 左テキストエリアのstateが変わったら APIにその内容を送信 2. レスポンスを右テキストエリアに表示 3.
コピー! で終わって、社内用ドキュメントに貼り付ける
Summary • ちょっと作るくらいならcreate-react-appで8割終わる ◦ 余談:裏がGoならgo-staikとかでReactの静的ファイル固めれば 1バイナリで配布できる • Java脳からはcomponent, state, propertyは理解しやすい
• propertyは型があって良い ◦ TSXはもっと良さそう • Styled componentだと1ファイルで済むから楽ちん(JSONで書けるし) Javaを噛ったことあるバックエンドエンジニアでも抵抗感少なく触れた