Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create the app:
npm init
Add React:
npm install --save react react-dom
Add webpack:
npm install --save-dev webpack webpack-cli webpack-dev-server
Add babel:
npm install --save-dev babel-core babel-loader babel-preset-env babel-preset-react
Add HTML webpack plugin:
npm install --save-dev html-webpack-plugin
Steal webpack.config.js file:
Steal .babelrc file:
Steal /src/index.html:
Create your index.js file (in the /src folder):
import React from "react";
import ReactDOM from "react-dom";
const HelloWorld = () => <article>
<h1>Hello world</h1>
ReactDOM.render(<HelloWorld />, document.getElementById('app'));
Start the server:
webpack-dev-server --mode development --open --hot
/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* BONUS POINTS */*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
1. Enable CSS imports
2. Make it work using SSR (works even with client-side javascript turned off)
(Find answers here:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.