Skip to content

Instantly share code, notes, and snippets.

@remy
Created June 19, 2018 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remy/cdfe48909c2e2eeab1c73b9a8ba8be71 to your computer and use it in GitHub Desktop.
Save remy/cdfe48909c2e2eeab1c73b9a8ba8be71 to your computer and use it in GitHub Desktop.
// via @github.com/electricg
// remove next.js custom scripts ala https://github.com/zeit/next.js/issues/3155#issuecomment-338708632
import React from 'react';
import { Head } from 'next/document';
export default class MyHead extends Head {
render() {
const { head, styles } = this.context._documentProps;
return (
<head {...this.props}>
{(head || []).map((h, i) =>
React.cloneElement(h, { key: h.key || i })
)}
{styles || null}
{this.props.children}
</head>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment