Commit 0f3fecfe authored by Matt Hamlin's avatar Matt Hamlin Committed by Tim Neutkens

Update emotion examples with new API for SSR and React endpoint (#2456)

* Update emotion examples with new API for SSR and React endpoint

* Actually fixing tab replacement
parent 5a840cc3
......@@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
"emotion": "^4.1.2",
"emotion": "^5.0.0",
"next": "^2.4.6",
"react": "^15.6.1",
"react-dom": "^15.6.1"
......
import Document, { Head, Main, NextScript } from 'next/document'
import { renderStaticOptimized } from 'emotion/server'
import { extractCritical } from 'emotion/server'
export default class MyDocument extends Document {
static getInitialProps ({ renderPage }) {
const page = renderPage()
const styles = renderStaticOptimized(() => page.html)
const styles = extractCritical(page.html)
return { ...page, ...styles }
}
......
import React from 'react'
import { hydrate, keyframes, fragment, injectGlobal } from 'emotion'
import styled from 'emotion/styled'
import styled from 'emotion/react'
// Adds server generated styles to emotion cache.
// '__NEXT_DATA__.ids' is set in '_document.js'
......@@ -69,15 +69,11 @@ export default () => {
return (
<div>
<Basic>
Cool Styles
</Basic>
<Basic>Cool Styles</Basic>
<Combined>
With <code>:hover</code>.
</Combined>
<Animated animation={bounce}>
Let's bounce.
</Animated>
<Animated animation={bounce}>Let's bounce.</Animated>
</div>
)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment