1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 09:13:19 +01:00

add react-snap

This commit is contained in:
Matthias Kretschmann 2018-03-27 10:00:52 +02:00
parent bf8165a366
commit a7376f23fd
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 12 additions and 8 deletions

View File

@ -17,6 +17,7 @@
"eslint": "^4.19.1", "eslint": "^4.19.1",
"eslint-plugin-react": "^7.7.0", "eslint-plugin-react": "^7.7.0",
"jest-cli": "^22.4.3", "jest-cli": "^22.4.3",
"react-snap": "^1.11.5",
"stylelint": "^9.1.3", "stylelint": "^9.1.3",
"stylelint-config-standard": "^18.2.0" "stylelint-config-standard": "^18.2.0"
}, },
@ -31,6 +32,7 @@
"build-js": "react-scripts build", "build-js": "react-scripts build",
"build": "npm-run-all build-css build-js", "build": "npm-run-all build-css build-js",
"test": "npm run lint && react-scripts test --env=jsdom", "test": "npm run lint && react-scripts test --env=jsdom",
"eject": "react-scripts eject" "eject": "react-scripts eject",
"postbuild": "react-snap"
} }
} }

View File

@ -1,14 +1,16 @@
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom' import { hydrate, render } from 'react-dom'
import { BrowserRouter as Router } from 'react-router-dom' import { BrowserRouter as Router } from 'react-router-dom'
import './index.css' import './index.css'
import App from './App' import App from './App'
import registerServiceWorker from './registerServiceWorker' import registerServiceWorker from './registerServiceWorker'
ReactDOM.render( const rootElement = document.getElementById('root')
<Router>
<App /> if (rootElement.hasChildNodes()) {
</Router>, hydrate(<Router><App /></Router>, rootElement)
document.getElementById('root') } else {
) render(<Router><App /></Router>, rootElement)
}
registerServiceWorker() registerServiceWorker()