Skip to content

Instantly share code, notes, and snippets.

@twilson63
Last active October 14, 2017 10:46
Show Gist options
  • Select an option

  • Save twilson63/fa84da89de7803ece89f0a5f83beffb9 to your computer and use it in GitHub Desktop.

Select an option

Save twilson63/fa84da89de7803ece89f0a5f83beffb9 to your computer and use it in GitHub Desktop.
Getting Started with React Using NextJS

Getting Started with React Using NextJS

If you want hot reloading and server side rendering etc. The best approach for react is nextjs.

Clone This Repo for the fast approach!

Step 1

Create new directory

mkdir foo

Step 2

Change into the directory and run the following commands

cd foo
npm install yarn -g
yarn init -y
yarn add next react react-dom
npm install json -g
json -I -f package.json -e 'this.scripts = { "start": "next start", "build": "next build", "dev": "next"}'
mkdir pages
echo 'export default () => <h1>Hello Next</h1>' > pages/index.js
yarn dev

This will install next and react and you can run your react app, using yarn dev, which includes hot module reloading and server side rendering.

Do your development

Step 3

Deploy to Now

npm install now -g
now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment