Skip to content

Export a ThemeVariables client component #17

@heysanil

Description

@heysanil

We should consider exporting a ThemeVariables or similar client component (meant to be included in the page <head>) as the new recommended PTE loader for Next.js, which is a simpler DX and solves issues around client-side theme variable changes getting rewritten in server-side reloads.

'use client';

import { generateThemeInjection, theme } from 'paris/theme';

export const ThemeVariables = () => (
    <>
        <script
            type="text/javascript"
            // eslint-disable-next-line react/no-danger
            dangerouslySetInnerHTML={{
                __html: generateThemeInjection(theme),
            }}
        />
    </>
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions