Skip to content

hfagerlund/react-app-starter

Repository files navigation

README

react-app-starter is a simple ('Dockerized') React app skeleton.

Fork and modify this project as a time-saving and easy to understand starter for your own new React project.

Quick Start

$ git clone https://github.com/hfagerlund/react-app-starter.git
$ cd react-app-starter
$ yarn install
$ yarn run build
$ yarn run start
# browser automatically opens to http://localhost:8080/build/home.html

Using Docker

# start Docker
$ sudo systemctl start docker

# build the image
## important - 'build' must not be listed in .dockerignore (else will fail)
$ sudo docker build . -t my-react-app -f Dockerfile

# list all images
$ sudo docker images

# run the container
$ sudo docker run -p 8000:80 my-react-app

# browse to http://localhost:8000/home.html

🎉

What's going on here?

  • React, react-dom - These libraries are installed using npm, the package manager for Node.js: $ npm i -S {react,react-dom}
  • Babel - Compiles JSX into JavaScript (for rendering in the browser);
  • JSX - A syntax extension to JavaScript used for creating React 'elements';
  • Webpack - Module bundler (ie. runs the code through Babel etc.);
    • HTML Webpack Plugin - Generates an HTML file to render the generated bundle.js file in the browser;
  • Docker - The entire app is both built (using Yarn) and deployed (to NGINX) inside Docker.

(All copyrights for the above remain with their respective owners.)


License

Copyright (c) 2019 Heini Fagerlund. Licensed under the BSD-3-Clause license.