-
Notifications
You must be signed in to change notification settings - Fork 824
Create SSR example for GatsbyJS #154
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
Comments
Create a file called /* eslint-disable react/no-danger */
import React from 'react'
import { extractStyles } from 'evergreen-ui'
exports.onRenderBody = ({ setHeadComponents }) => {
// Get the css and hydration script from Evergreen.
const { css, hydrationScript } = extractStyles()
// Takes an array of components as its first argument which are added to
// the headComponents array which is passed to the html.js component.
setHeadComponents([
// We need a key here for Gatsby to stop complaining.
<React.Fragment key="evergreen-ssr">
<style id="evergreen-css" dangerouslySetInnerHTML={{ __html: css }} />
{hydrationScript}
</React.Fragment>,
])
} |
Hi, how would this work for React-Static? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
I am using Gatsby for some of my prototypes and want to make SSR work. I will add an example as soon as I have done this.
The text was updated successfully, but these errors were encountered: