Skip to content

Custom directives for NextJs 13 #5840

Closed
@CarlOlson

Description

@CarlOlson

NextJs 13 introduces a new app directory for utilizing server components. Client components imported by a server component must have a "use client"; directive similar to strict mode. Using raw doesn't work because the directive must be above all code/imports.

Here are some ideas I thought of:

// 1. With a directive at the top of file
"use client"

// 2. At anywhere in the top level with a compiler directive
@@directive("use client")

// 3. Change %%raw to put code (or just directives) above imports
%%raw(`"use client";`)

And since so many files will have the same name, #4874 would also help with a big pain point of using NextJs w/ ReScript.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions