Ever heard of Preact? It’s a React.js alternative that praises itself for being much smaller and therefore faster. Despite high compatibility to React.js.

I wondered how useful Preact really is, so I built the exact same app in React.js and Preact. Then I measured the size, differences, and performance of the two apps in a fair competition.

Let’s start with the differences when working with the two libraries, then we look at the app code & measure the performance. Have fun!

Creating a React project, and a Preact project

For React.js, this should be known already: npm install -g create-react-app and then create-react-app <project-name>, to start working in the project directory, just cd /<project-name> — there we go and we can start editing the files.

Let’s create the Preact project now: npm install -g preact-cli, then preact create default <project-name> — default is the name of the starter template, we are going to use.

#javascript #preact #programming #web-development #reactjs

I Built the Same App With React and Preact. Here are the differences
1.65 GEEK