Telerik DevRel
Developer Relations team @ Telerik!
@jenlooper
tinkerer?
magic bean-buyer?
Not to be confused with React.js
"Fast 3kB alternative to React with the same ES6 API."
small and focused
15K+ stars on Github
101 contributors
supports modern browsers
choices
*or pre-React, or petit-React, or poutine-React, depends
Preact is geared towards working directly with the DOM in a browser. There are no separate renders of the DOM, so no extra abstractions.
Relies on native browser events, not synthetic abstractions of them - so it doesn't natively support really old browsers ( you can polyfill)
https://soundcloud.com/5minreact_audio/004-preact
Treats the web as a stable platform, supports modern browsers
started as a codepen to experiment with different optimizations
provides the thinnest possible Virtual DOM abstraction on top of the DOM.
one of the fastest Virtual DOM libraries available.
diffs Virtual DOM against the DOM itself
drop-in Preact modules to an existing app. It's tiny, nobody will notice!
https://preactjs.com/repl
layer on the preact-compat library to render your Preact site compatible to your React site
https://github.com/developit/preact-compat
size, obvs
some changes to React's API
*the way the DOM is handled: "Preact uses the DOM's event system directly instead of abstracting it."
*the diffing model (change detection): "Preact diffs very differently from React - it diffs your Virtual DOM tree against the actual DOM tree"
https://jasonformat.com/preact-ama-on-sideway/
you are interested in learning how React works
you are looking for a super-fast tiny React-like framework
you need a teeny drop-in piece to add to an existing app
you're totally fine with React
you aren't comfortable with managing the DOM
you think React Fiber will solve perf issues
"there will never be a Preact Native"
var Demo = comp(
{
render: function (props) {
console.log('Demo', props.input)
return h('Page', null, [
h('StackLayout', null, [
h('Label',{value: 'OMG wowza its Preact Native!'})
])
])
}
}
)
applicationModule.start({
create: function () {
return render(Demo)
}
})
https://github.com/staydecent/nativescript-preact
https://github.com/jlooper/quicknoms-preact
By Telerik DevRel