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ハンズオン 01 入門編 コード部分抜粋 / React Handson 01 co...
Search
Shunsuke Watanabe
October 06, 2018
Programming
600
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Reactハンズオン 01 入門編 コード部分抜粋 / React Handson 01 components (excerpt)
改訂2版
Shunsuke Watanabe
October 06, 2018
More Decks by Shunsuke Watanabe
See All by Shunsuke Watanabe
いますぐ {id: number;} をやめろ
craftgear
1
380
forループを越えて / beyond for loop
craftgear
0
590
Reactハンズオン 02 redux編 コード部分抜粋 / React Handson 02 redux (excerpt)
craftgear
0
600
Reactハンズオン 01 入門編 コード部分抜粋 / React Handson 01 components (excerpt)
craftgear
0
730
Reactで作るDrupalサイト
craftgear
0
510
大阪Node学園 七時限目 「ゼロからはじめるnode.js」
craftgear
1
430
大阪Node学園 六時限目 「generator小咄」
craftgear
1
350
大阪Node学園四時限目 "This crazy testless world"
craftgear
1
350
Other Decks in Programming
See All in Programming
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.8k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
270
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
360
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
140
Embedded SREと共に達成した会員管理システムのAWS移行 - SRE NEXT 2026 ランチスポンサーセッション
niftycorp
PRO
1
2.2k
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
2
240
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
1年で人数1.5倍、PR数5.5倍増。 品質とアウトカムはどうなったか、 何が効いたか
ike002jp
0
120
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
140
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
300
関数型プログラミングのメリットって何だろう?
wanko_it
0
160
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
160
Featured
See All Featured
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
490
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
320
Crafting Experiences
bethany
1
210
Game over? The fight for quality and originality in the time of robots
wayneb77
1
220
Site-Speed That Sticks
csswizardry
13
1.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Scaling GitHub
holman
464
140k
Are puppies a ranking factor?
jonoalderson
1
3.7k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
210
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
210
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
340
Transcript
1 // src/components/HelloWorld.js 2 3 import React from 'react'; 4
5 export default () => { 6 return <h1>Hello World</h1> 7 } 1 // src/App.js 2 3 import React, { Component } from 'react'; 4 import logo from './logo.svg'; 5 import './App.css'; 6 import HelloWorld from './components/HelloWorld'; 7 8 class App extends Component { 9 render() { 10 return ( 11 <div className="App"> 12 <HelloWorld /> 13 <header className="App-header"> 14 <img src={logo} className="App-logo" alt="logo" /> 15 <h1 className="App-title">Welcome to React</h1> 16 </header> 17 <p className="App-intro"> 1
1 // src/App.js 2 …… 8 class App extends Component
{ 9 render() { 10 return ( 11 <div className="App"> 12 <HelloWorld greeting="͓Α͏" /> …… 20 </div> 21 ); 22 } 23 } 24 25 export default App; 1 // src/components/HelloWorld.js 2 3 import React from 'react'; 4 5 export default props => { 6 return <h1>{props.greeting} World</h1>; 7 }; 2
1 // src/components/HelloWorld.js 2 3 import React from 'react'; 4
5 export default ({ greeting }) => { 6 return <h1>{greeting} World</h1>; 7 }; 3
1 // src/components/HelloWorld.js 2 3 import React from 'react'; 4
5 export default ({ greeting = 'Bonjour' }) => { 6 return <h1>{greeting} World</h1>; 7 } 1 // src/App.js 2 …… 8 class App extends Component { 9 render() { 10 return ( 11 <div className="App"> 12 <HelloWorld /> …… 20 </div> 21 ); 22 } 23 } 24 25 export default App; 4 ←greetingΛফ͢
1 // src/components/HelloWorld.js 2 3 import React from 'react'; 4
5 const styles = { 6 h1: { 7 color: 'gold', 8 backgroundColor: 'black' 9 } 10 } 11 12 export default ({ greeting = 'Bonjour', to }) => { 13 return ( 14 <h1 style={styles.h1}> 15 {greeting} {to} 16 </h1> 17 ); 18 }; 5
1 // src/App.js …… 8 class App extends Component {
9 constructor(props) { 10 super(props); 11 this.state = { 12 greeting: 'Hello', 13 to: 'World', 14 }; 15 this.updateGreeting = this.updateGreeting.bind(this); 16 } 17 18 updateGreeting() { 19 this.setState({ greeting: '͜Μʹͪ' }); 20 } 21 22 render() { 23 return ( 24 <div className="App"> 25 <HelloWorld greeting={this.state.greeting} to={this.state.to} /> 26 <button onClick={this.updateGreeting}>͍͋ͭ͞มߋ</button> 27 <header className="App-header"> 28 <img src={logo} className="App-logo" alt="logo" /> 6