This file contains 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 { hydrate } from "react-dom"; | |
import App from "./app"; | |
import { BrowserRouter as Router } from "react-router-dom"; | |
hydrate( | |
<Router> | |
<App /> | |
</Router>, | |
document.getElementById("app") |
This file contains 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 express from "express"; | |
import React from "react"; | |
import { renderToString } from "react-dom/server"; | |
import { StaticRouter as Router } from "react-router-dom"; | |
import path from "path"; | |
import App from "./client/app"; | |
const app = express(); | |
const port = 3000; | |
import Routes from "./routes"; |
This file contains 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, { Component, Fragment } from "react"; | |
export default class Home extends Component { | |
render() { | |
return ( | |
<Fragment> | |
<p>this is Home</p> | |
</Fragment> | |
); | |
} |
This file contains 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 Home from "./client/pages/home/home"; | |
import About from "./client/pages/about/about"; | |
import NotFound from "./client/pages/not-found/not-found"; | |
const Routes = [ | |
{ | |
url: "/", | |
exact: true, | |
component: Home | |
}, |
This file contains 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 express from "express"; | |
import React from "react"; | |
import { renderToString } from "react-dom/server"; | |
import App from "./client/app"; | |
const app = express(); | |
const port = 3000; | |
const HTML = (req, context) => { | |
const body = renderToString(<App />); |
This file contains 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 { hydrate } from "react-dom"; | |
import App from "./app"; | |
hydrate(<App />,document.getElementById("app")); |
This file contains 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, { Component, Fragment } from "react"; | |
export default class App extends Component { | |
render() { | |
return ( | |
<Fragment> | |
<div>Hello World</div> | |
</Fragment> | |
); |
This file contains 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 { hydrate } from "react-dom"; | |
hydrate( | |
<div>Hello World</div>, | |
document.getElementById("app") | |
); |
This file contains 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
"scripts": { | |
"start": "npm-run-all --parallel watch:build watch:server", | |
"watch:build": "webpack --watch", | |
"watch:server": "nodemon \"./server.js\" --watch \"./ \"" | |
}, |
This file contains 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 express from 'express'; | |
const app = express() | |
const port = 3000 | |
app.get('/', (req, res) => res.send('Hello World!')) | |
app.listen(port, () => console.log(`Example app listening on port ${port}!`)) |