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
Intro to Reactjs
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Michael Lancaster
May 12, 2015
Technology
2.2k
5
Share
Intro to Reactjs
A quick intro to React.js
Michael Lancaster
May 12, 2015
More Decks by Michael Lancaster
See All by Michael Lancaster
Docker?! But I'm a frontend.
weblancaster
3
510
Soundnode, The Journey
weblancaster
0
270
intro to javascript unit tests for client side
weblancaster
0
200
Desktop Apps with NW.js and Angular.js (updated)
weblancaster
9
2.4k
CSS the right way?
weblancaster
15
2.1k
Other Decks in Technology
See All in Technology
Javaで学ぶSOLID原則
negima
1
280
タクシーアプリ『GO』の実践的データ活用
mot_techtalk
2
110
Platform engineering for developers, architects & the rest of us (AI agents)
danielbryantuk
0
180
大学生が本気でDatabricksを活用してDiscordサークルをデータ駆動させてみた
phantomjuju
1
340
電子辞書Brainをネットに繋げてみた(自力編)
raspython3
0
430
個人の発見を、組織の知恵に 〜生成AI活用を"探索"から"組織の仕組み"へ〜
kintotechdev
2
870
トークン数だけでは測れない — Claude Code 組織展開の効果検証から学んだこと
makikub
0
120
探して_入れて_作って_使う_Agent_Skills___LT.pdf
peintangos
2
160
速さだけじゃない! VoidZero ツールが移行先に選ばれる理由
mizdra
PRO
6
730
Datadog 認定試験の概要と対策
uechishingo
0
230
「速く作る」から「正しく作る」へ ─ 生成AI時代の開発フロー改革の ロードマップと実行 ─
starfish719
0
6.3k
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development with AI-DLC
yoshidashingo
0
110
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
174
15k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
570
The Cult of Friendly URLs
andyhume
79
6.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Navigating Team Friction
lara
192
16k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
Transcript
Intro to React.js
How a Chinese Company built a 57-storey skyscrapers in 19
days?
None
None
None
Composability Encapsulation Reusability Declarative Flexibility Performance Interoperability
None
JSX
import React from "react"; import ReactDOM from "react-dom"; class App
extends React.Component { constructor(props) { super(props); this.state = { todos: ['buy soy milk', 'call mom'] } } render() { return (<div><Todos todos={this.state.todos} /></div>) } } const Todos = ({todos}) => { return ( <ul> {todos.map(todo => { return <TodoItem key={todo.replace(' ', ‘’)} todo={todo} /> })} </ul> ) }; const TodoItem = ({todo}) => (<li>{todo}</li>); const rootElement = document.getElementById("root"); ReactDOM.render(<App />, rootElement);
None
Compiled
var App = (function(_React$Component) { _inherits(App, _React$Component); function App(props) {…}
_createClass(App, [ { key: "render", value: function render() { return React.createElement( "div", null, React.createElement(Todos, { todos: this.state.todos }) ); } } ]); return App; })(React.Component); var Todos = function Todos(_ref) { var todos = _ref.todos; return React.createElement( "ul", null, todos.map(function(todo) { return React.createElement(TodoItem, { key: todo.replace(" ", ""), todo: todo }); }) ); }; var TodoItem = function TodoItem(_ref2) { var todo = _ref2.todo; return React.createElement("li", null, todo); };
import React from "react"; import ReactDOM from "react-dom"; class App
extends React.Component { constructor(props) { super(props); this.state = { todos: ['buy soy milk', 'call mom'] } } render() { return (<div><Todos todos={this.state.todos} /></div>) } } const Todos = ({todos}) => { return ( <ul> {todos.map(todo => { return <TodoItem key={todo.replace(' ', ‘’)} todo={todo} /> })} </ul> ) }; const TodoItem = ({todo}) => (<li>{todo}</li>); const rootElement = document.getElementById("root"); ReactDOM.render(<App />, rootElement);
Diff Algorithm
Level by Level * source http://calendar.perfplanet.com/2013/diff/
Components * source http://calendar.perfplanet.com/2013/diff/
List * source http://calendar.perfplanet.com/2013/diff/
Batching * source http://calendar.perfplanet.com/2013/diff/
Sub-tree rendering * source http://calendar.perfplanet.com/2013/diff/
Selective Sub-tree rendering * source http://calendar.perfplanet.com/2013/diff/
Component Lifecycle
Mounting Update (new props or state) constructor() static getDerivedStateFromProps() render()
componentDidMount() static getDerivedStateFromProps() shouldComponentUpdate() render() getSnapshotBeforeUpdate() componentDidUpdate() Unmounting componentWillUnmount() Error Handling static getDerivedStateFromError() componentDidCatch()
Props vs State
- Props State Can get initial value from parent Component?
Yes Yes Can be changed by parent Component? Yes No Can set default values inside Component? Yes Yes Can change inside Component? No Yes Can set initial value for child Components? Yes Yes
React-Native React-Native-Web React-Primitives React-Sketch React-360 React-Native-Windows
Demo
Thanks!