Skip to content

Instantly share code, notes, and snippets.

@danielnmai
Created September 8, 2018 16:44
Show Gist options
  • Save danielnmai/d41d1f83e264135f499f1dfc26fe8bdc to your computer and use it in GitHub Desktop.
Save danielnmai/d41d1f83e264135f499f1dfc26fe8bdc to your computer and use it in GitHub Desktop.
Root file for client side
import React from 'react';
import { hydrate } from 'react-dom'
import App from './App.js'
import ContextProvider from './ContextProvider.js'
const context = {
insertCss: (...styles) => {
const removeCss = styles.map(x => x._insertCss());
return () => {
removeCss.forEach(f => f());
};
},
}
hydrate(<ContextProvider context={context}>
<App />
</ContextProvider>, document.getElementById('app'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment