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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hello World Tech Conference
February 15, 2018
Programming
88
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
70
Hello World 2018 - Understanding attacker behaviors, motivations and common ways of operation
helloworldconf
0
81
Hello World 2018 - GraphQL A query language for your API
helloworldconf
1
92
Hello World 2018 - Why Ruby?
helloworldconf
0
51
Hello World 2018 - Recent Advances in Machine Learning
helloworldconf
0
75
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
87
Other Decks in Programming
See All in Programming
My Marp Sample
sinoue0108
0
140
[DroidKaigi 26] How We Moved from Android Studio to Slack
thisaay
0
140
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
390
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
250
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
270
AIの中の人になってみる
htkym
0
150
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
270
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
640
ソフトウェアラスタライザ
fadis
1
760
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
180
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
290
自動化したのに回らない テスト運用の壁―AI時代の品質責任と生産性
mfunaki
0
560
Featured
See All Featured
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
570
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
850
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Building an army of robots
kneath
306
46k
Crafting Experiences
bethany
1
270
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
370
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
220
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
320
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