initial commit

This commit is contained in:
JJ Kasper
2018-05-17 14:31:05 -05:00
commit 2c90d2e7dd
79 changed files with 10684 additions and 0 deletions

21
util/freezeSSR.js Normal file
View File

@@ -0,0 +1,21 @@
const freezeSSR = selector => {
const FrozenSSR = () => {
let __html = '';
let props = {};
if(typeof document !== 'undefined') {
let el = document.querySelector(selector);
if(el) {
__html = el.innerHTML;
el.getAttributeNames().forEach(attr => {
const attrKey = attr === 'class' ? 'className' : attr;
props[attrKey] = el.getAttribute(attr);
});
}
}
return <div {...props} dangerouslySetInnerHTML={{ __html }} />;
};
return { loading: FrozenSSR };
};
export default freezeSSR;