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
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
260
intro to javascript unit tests for client side
weblancaster
0
190
Desktop Apps with NW.js and Angular.js (updated)
weblancaster
9
2.3k
CSS the right way?
weblancaster
15
2.1k
Other Decks in Technology
See All in Technology
FessのAI検索モード:検索システムとLLMへの取り組み
marevol
0
170
Modernizing Your HCL Connections Experience: Visual Report to chain, Profile Enhancements, and AI Integration
wannesrams
0
250
AWS Transform CustomでIaCコードを自由自在に変換しよう
duelist2020jp
0
220
ハーネスエンジニアリングをやりすぎた話 ~そのハーネスは解体された~
gotalab555
5
2k
Fabric MCPの紹介と使い分け
ryomaru0825
1
110
Percolatorを廃止し、マルチ検索サービスへ刷新した話 / Search Engineering Tech Talk 2026 Spring
visional_engineering_and_design
0
230
多角的な視点から見たAGI
terisuke
0
110
バイブコーディングで3倍早く⚪⚪を作ってみた
samakada
0
210
Oracle Cloud Infrastructure:2026年4月度サービス・アップデート
oracle4engineer
PRO
0
260
エージェント時代の UIとAPI、CLI戦略
coincheck_recruit
0
110
Digital Independence: Why, When and How
wannesrams
0
230
世界の中心でApp Runnerを叫ぶ FINAL
tsukuboshi
0
190
Featured
See All Featured
Music & Morning Musume
bryan
47
7.2k
GraphQLとの向き合い方2022年版
quramy
50
15k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
110
Bash Introduction
62gerente
615
210k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
760
Automating Front-end Workflow
addyosmani
1370
200k
Documentation Writing (for coders)
carmenintech
77
5.3k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
The Invisible Side of Design
smashingmag
303
52k
Heart Work Chapter 1 - Part 1
lfama
PRO
6
35k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
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!