Skip to content

Instantly share code, notes, and snippets.

Last active April 6, 2022 19:27
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
nextjs-typestyle 🌹
import App from 'next/app'
import { setStylesTarget } from 'typestyle'
export default class MyApp extends App {
componentDidMount() {
* Hydrate typestyle
import Document from 'next/document';
import { getStyles } from 'typestyle';
export default class CustomDocument extends Document {
static async getInitialProps(ctx: any) {
const initialProps = await Document.getInitialProps(ctx)
return {
styles: (
{<style id='styles-target' dangerouslySetInnerHTML={{
__html: getStyles()
Copy link

Thank you! It helped me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment