selrond / next-react-app

CRA-like boilerplate in Next.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

next-react-app

The problem

If you want to develop a client-side application with React, you will need some kind of a starter / boilerplate (provided — of course — configuring Webpack isn't your passion). You'd probably reach for Create React App being the most popular one.

It has some not-so-nice caveats though, including:

This solution

By using Next.js toolchain you can get the same benefits as CRA gives you, only without the caveats.

Plus you get:

and much more

For more information, I highly recommend reading Replacing Create React App with the Next.js CLI

Getting started

This repo is a simple Next.js starter configured to redirect all requests to the index page, effectively behaving like a SPA. Read the official docs for more information.

Development:

  1. npm run dev to start the development environment

Production:

  1. npm run build - to build, bundle & export static files
  2. npm start - to start a server to preview the build

Inspired by @tannerlinsley's gist and tweet and another tweet

About

CRA-like boilerplate in Next.js

License:MIT License


Languages

Language:JavaScript 100.0%