Minimal React project template
Although it is strongly criticised for its bloat, create-react-app is often a go to when starting a new React project. I like to start things from the bottom up, adding things up as I need them so, I prefer a minimalistic approach.
It’s actually very easy to setup a bare-bones React project using parcel. Here’s how to do it.
Initialise npm project
npm init -y
Some adjustments are needed to
package.json. I’m gonna change the
source, pointing to the
index.html of my project. I’m gonna create an
src/index.html for the interim.
Here’s the resulting package.json.
parcel as build system and bundler.
npm install --save-dev parcel
Obviously, I’m adding React as dependency
npm install react react-dom
I’m gonna start with the
I’m using it in
index.jsx which is my entry point.
This is included in
This can be rendered with
Or bundled using the
Babel and JSX translation
You don’t need Babel at all as parcel is taking care of JSX translation out of the box.
Code discussed in this post is available in gitlab repo.