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
Hello World 2018 - We need to talk about Preact
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Hello World Tech Conference
February 15, 2018
Programming
85
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Hello World 2018 - We need to talk about Preact
Hello World Tech Conference
February 15, 2018
More Decks by Hello World Tech Conference
See All by Hello World Tech Conference
Hello World 2018 - Learn how to get that dream job at Google!
helloworldconf
0
120
Hello World 2018 - Introduction to Swift
helloworldconf
0
67
Hello World 2018 - Understanding attacker behaviors, motivations and common ways of operation
helloworldconf
0
76
Hello World 2018 - GraphQL A query language for your API
helloworldconf
1
87
Hello World 2018 - Why Ruby?
helloworldconf
0
50
Hello World 2018 - Recent Advances in Machine Learning
helloworldconf
0
71
Hello World 2018 - Quality from the start
helloworldconf
0
38
Hello World 2017 - React Native
helloworldconf
0
120
Hello World 2017 - Testing & QA - Carreira Profissional?
helloworldconf
0
85
Other Decks in Programming
See All in Programming
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
290
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
200
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
270
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
230
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
230
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
560
Oxcを導入して開発体験が向上した話
yug1224
4
340
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
410
dRuby over BLE
makicamel
2
390
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
110
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
600
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Building an army of robots
kneath
306
46k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
740
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
150
Tell your own story through comics
letsgokoyo
1
980
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
66
55k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
340
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
From π to Pie charts
rasagy
0
220
Transcript
WE NEED TO TALK ABOUT PREACT
HELLO! I am Sara I work at YLD and make
useless stuff on the internet @NikkitaFTW
Portugal
REMEMBER THIS JOKE?
Y’ALL JUST LOST TO A TEAM OF FLAMINGOS
PREACT
I know what your first question is !
I brought them stickers
1. What ? 2. Who ? 3. Why ? 4.
Future ? 5. The CLI
WHAT IS PREACT ?
None
IS IT PRODUCTION READY ?
None
YES !
WHO MADE PREACT ?
Jason Miller / @developit
WHY PREACT ?
THE COMMUNITY There is an amazing community behind preact !
None
None
None
None
None
IT’S PERFORMANT Preact is 3KB and was made with performance
in mind
X KB OF JS IS NOT THE SAME AS X
KB OF IMAGES The browser has to download it but also parse it and in older devices this may be the biggest problem
BENCHMARKS
Firefox 57.0 (64-bit)
Chrome Version 62 (64-bit)
REACT COMPATIBILITY You can use it with any react component
yarn add preact-compat { // ... resolve: { alias: {
'react': 'preact-compat', 'react-dom': 'preact-compat', // Not necessary unless you consume a module using `createClass` 'create-react-class': 'preact-compat/lib/create-react-class' } } // ... } How ?
What’s included in Preact ?
ES6 CLASS COMPONENTS And all the awesome lifecycle methods of
course
HIGH ORDER COMPONENTS Create them composes
FUNCTIONAL COMPONENTS Functions that just receive props as arguments and
return JSX/VDOM
CONTEXT In some cases, you want to pass data through
the component tree without having to pass the props down manually at every level. You can do this directly in with the “context” API.
REFS We all use it, don’t lie
VIRTUAL DOM DIFFING Preact's diff is simple but effective, and
extremely fast.
What’s added in Preact ?
PROPS AND STATE IN RENDER this.props and this.state are passed
to render() for you. THIS IS SO SWEET
class Home extends Component { constructor() { super(); this.state =
{ loading: true } } render = () => { const { name } = this.props; const { loading } = this.state; return ( <div> {loading ? ‘Loading...’ : name} </div> ) } }
class Home extends Component { state = { loading: true
} render = ({ name }, { loading }) => ( <div> {loading ? ‘Loading...’ : name} </div> ) }
DOM UPDATES Batching of DOM updates, debounced/collated using setTimeout (can
also use requestAnimationFrame)
CSS CLASS You can just use class for CSS classes.
className is still supported, but class is preferred.
Component and element recycling / pooling.
What’s missing in Preact ?
DANGEROUSLY SET innerHTML Do we really want this ? There
is preact-markup to fill this gap
SYNTHETIC EVENTS Preact's browser support target does not require this
extra overhead. Preact uses the browser's native addEventListener for event handling
BROWSER SUPPORT Preact supports modern browsers (Chrome, Firefox, Safari, Edge)
and IE9+
FUTURE
FASTER DIFFING ALGORITHM
ARRAY RETURNS
FRAGMENT SUPPORT
ASYNC DIFFING
DEMO TIME Let’s talk about the preact-cli
THANK YOU