Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[RSC - client directive] : Not working has expected #423

Unanswered
StephaneIzi asked this question in Q&A
Discussion options

Hi, first thank you for this amazing repository ❤️ .

contentlayer has been really useful to me lately.

TLDR : Should i expect contentlayer to handle React Component with client directive inside MDX ?


I want to use contentlayer to hold all my content (mdx files)

The stack is :

  • nextJS 13
  • contentlayer
  • tailwind

Here is a repo with the stack : https://github.com/Stephane-Pires/contentlayer-mdx-client-directive

I started with MDX using @next/mdx (commit : 1ef8551c6206eb44f0f1717f2f8c32eef7da22d0) , everything was working fine, i was able to import Component with and without use client directive directly inside my mdx files. (Below a gif of the working <Counter /> Button)

file : https://github.com/Stephane-Pires/contentlayer-mdx-client-directive/blob/main/content/hello.mdx

Screen.Recording.2023年04月16日.at.18.58.20.mov

Then i tryied MDX using @contentlayer & @next-contentlayer(commit : a3c027e455de3fda8b329ad2e2113b0c38c042e4)

Screenshot 2023年04月16日 at 19 08 00

Everything is working has expected.

Things started to go off track when i added the <Counter /> component inside MDX files.

I tryied :

  • commit : 4761f0852b87a30de8de554e5155d3b3cc00015b
  • commit : 353b94051bc2b1b5d6d55d6e290ad3c389776ed9

From my understanding so far, contentlayer could handle Client Component

https://github.com/contentlayerdev/contentlayer/releases

Note: While it's theoretically also possible to use Contentlayer combined with the 'use client' approach, we don't recommend it as it massively increases page sizes and thus the page load time.

My question is : Should i expect contentlayer to handle React Component with client directive inside MDX ?

P.S : I really want to use contentlayer the types generation is a big plus for me !

Thanks for reading !

You must be logged in to vote

Replies: 1 comment

Comment options

Possibly related to this #309 (comment)

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /