This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { BrowserRouter, Link, Route } from 'react-router-dom'; | |
import HelloWorld from './HelloWorld'; | |
const App = () => ( | |
<BrowserRouter> | |
<div> | |
<ul> | |
<li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"license": "MIT", | |
"scripts": { | |
"dev:server": "node src/js/server.dev.js" | |
}, | |
"dependencies": { | |
"express": "^4.14.1", | |
"pug": "^2.0.0-beta11", | |
"react": "^15.4.2", | |
"react-dom": "^15.4.2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
const HelloWorld = props => <h1>Hello World from {props.location.pathname}</h1>; | |
export default HelloWorld; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { render } from 'react-dom'; | |
import App from './components/App'; | |
render(<App />, document.getElementById('root')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
["es2015", { "modules": false }], | |
"react", | |
"stage-0" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var config = { | |
entry: path.join(__dirname, 'src/js/index.js'), | |
output: { | |
path: '/', | |
publicPath: 'http://localhost:3000/', | |
filename: 'bundle.js' | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctype html | |
html | |
head | |
meta(charset='UTF-8') | |
title React Universal App | |
body | |
#root | |
script(src='/bundle.js') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var path = require('path'); | |
var webpack = require('webpack'); | |
var webpackDevMiddleware = require('webpack-dev-middleware'); | |
var webpackConfig = require(path.join(__dirname, '../../webpack.dev.config.js')); | |
var app = express(); | |
var compiler = webpack(webpackConfig); | |
app.set('view engine', 'pug'); |