Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
[ReactJS How to Workshop] Day 01
Search
Khánh Trần
September 24, 2016
Programming
56
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[ReactJS How to Workshop] Day 01
Slide for my workshop about ReactJS at geekup.vn
Khánh Trần
September 24, 2016
More Decks by Khánh Trần
See All by Khánh Trần
Docker-Compose workshop
rualatngua
2
230
ReactJS - The Container component pattern
rualatngua
0
66
Seneca workshop
rualatngua
0
150
Other Decks in Programming
See All in Programming
FreeBSDでZabbixを動かす
kenkino
0
330
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
110
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
320
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
180
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
170
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
8.7k
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
540
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
220
アクセシビリティから考える情報設計
high_g_engineer
0
420
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
560
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.4k
AWSに止められる覚悟してますか?
morizo_1984
2
410
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1033
470k
Balancing Empowerment & Direction
lara
6
1.3k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Scaling GitHub
holman
464
140k
Tell your own story through comics
letsgokoyo
1
1.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Leo the Paperboy
mayatellez
10
2.3k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
830
Prompt Engineering for Job Search
mfonobong
0
460
Done Done
chrislema
187
17k
Transcript
ReactJS How to
Today topics • Set-up and Run 1st demo • ES6
Crash course • Project structure & Workflow • Components & JSX Syntax • And Components ... and components
Set-up and Run 1st demo npm install -g create-react-app create-react-app
my-app cd my-app/ npm start Open Demo
ES6 Crash course An JavaScript file is a module... //
file foo.js const COLOR_THEME = 'Ocean'; function sayHello(name) { console.log(`Hello ${name}`); } class Foo { sum(a, b) { return a + b; } } export default Foo; export {COLOR_THEME, sayHello};
ES6 Crash course Export and export default export default Foo;
export {COLOR_THEME, sayHello};
ES6 Crash course Import from a module import Foo, {sayHello,
COLOR_THEME} from './foo'; //don't need .js for import js // or only default class Foo import Foo from './foo'; // or rename to new name import Foo as Bar from './foo'; // or only sayHello function import {sayHello}
ES6 Crash course Arrow Function function sum(a, b) { return
a + b; } const sum = (a, b) => a + b; const arr = [4, 5, 8, 2, 1, 3, 9, 7]; // filter odd number only console.log( arr.filter(number => number % 2 === 0) );
Project Structure & Workflow
Its dead simple to add new component React Color npm
install react-color --save import React from 'react'; import { SketchPicker } from 'react-color'; class Component extends React.Component { render() { return <SketchPicker />; } }
index.js import React from 'react'; import ReactDOM from 'react-dom'; import
App from './App'; ReactDOM.render( <App />, document.getElementById('root') );
packages.json 1. dependencies 2. devDependencies 3. scripts npm install --save
react-color npm install --save-dev chancejs
Render component import React, { Component } from 'react'; import
logo from './logo.svg'; import './App.css'; class App extends Component { render() { return ( <div className="App"> <div className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <h2>Welcome to React</h2> </div> <p className="App-intro"> To get started, edit <code>src/App.js</code> and save to reload. </p> </div> ); } } export default App;
Development Tools 1. Webpack • Handling all assets • Leverage
Import css/sass/image/svg • Post process 2. Babel: translsate ES6 to ES5 3. Npm: npm start and npm build
Let make a Button From Class component... import React from
'react'; class Button extends React.Component { render () { const {text, onClick} = this.props; return ( <button onClick={onClick}>{text}</button> ); } } export default Button;
Let make a Button ... to Function component import React
from 'react'; const Button = ({ text, onClick }) => { <button onClick={onClick}>{text}</button> } export default Button;
Learning Resources • How to develop apps bootstrapped with Create
React App. • Grommet getting start • React JS and why it's awesome • Ecosystem
What next? • Lifecycle methods • Props and State •
Routing • Manage Application State with Mobx • Handle form • Testing with Jest • Styling & Responsive