DEV Community

React vs Preact?

Ali Abbas on June 08, 2019

For a small project that needa blazing fast speed, which to prefer.

  • REACT
  • PREACT
  • INFERNO
  • MITHRIL
  • MOON
Collapse
 
vonheikemen profile image
Heiker

Blazing fast in what sense? Creating nodes, Updating the ui, bundle size?

Both Preact and React are fast enough.

I will choose Preact, because is 3kb.

But if you want to use hooks with preact you have to install an unstable version preact@next because the stable version doesn't have them.

Collapse
 
solarliner profile image
🇨🇵️ Nathan Graule

Preact entered beta a few weeks ago, and so far it's been quite stable. I'm using it for 2 projects - nothing to report bar one quirky TypeScript typing.

Collapse
 
itsjzt profile image
Saurabh Sharma

I would say start with react and eject when you find preact is actually making your app faster.

Collapse
 
beey12345 profile image
Beey

For blazing fast speed generaly(You didnt give in specific about what) Even tho react and preact can run fast i would say to get preact heres why:

Preact is shorter than react meaning it will take less time to load the files

One major downside to point out: hooks you have alot of options that take longer than react hooks(React hooks are built-in).

Some options for hooks in preact:

Preact 10 or known as Preact X and newer have stable release's of hooks

You can import hooks with import { HOOK_NAME } from "preact/hooks"

For older models like preact 9 or 8 you will have to use preact@next and that is unstable

Just one note: I dont think you can run hooks without an unstable version on preact 9 or older as those were models from before 2019 June 27

Collapse
 
maheshkale profile image
Mahesh K

Preact, definitely. I'd say you can also use react with better CDN for serving media elements. If that's something you are planning on using.

Collapse
 
anpos231 profile image
anpos231

Inferno ;P