devjiwonchoi / remote-mdx

Use MDX in your React App
https://npmjs.com/remote-mdx
MIT License
13 stars 2 forks source link

Issue with next 14.3.0-canary.54 #10

Closed FairyPenguin closed 5 months ago

FairyPenguin commented 5 months ago

Hi @devjiwonchoi, Hope you are doing well.

I want to thank you for this package.

The package broke once i updated to the latest beta of nextjs 14.3.0-canary.54

i get this error


Warning: Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.
  <article className=... children={{$$typeof: ..., type: ..., key: Null, ref: ..., props: ..., _owner: ..., _store: ...}}>
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ⨯ Error: Functions are not valid as a child of Client Components. This may happen if you return MDXContent instead of <MDXContent /> from render. Or maybe you meant to call this function rather than return it.
  {$$typeof: ..., type: function MDXContent, key: ..., ref: ..., props: ..., _owner: ..., _store: ...}
                        ^^^^^^^^^^^^^^^^^^^
    at stringify (<anonymous>)
digest: "1723576498"

I;m using the compileMDX function

import { compileMDX } from 'remote-mdx/rsc'

for now i rolled-back to the previous beta version and everything seems to be working fine

devjiwonchoi commented 5 months ago

@FairyPenguin Hi, I'd love to solve your issue, can you provide a minimum reproduction so I can fix it ASAP for you? I'm also using next@canary but am not observing the issue ATM.

FairyPenguin commented 5 months ago

@FairyPenguin Hi, I'd love to solve your issue, can you provide a minimum reproduction so I can fix it ASAP for you? I'm also using next@canary but am not observing the issue ATM.

Thanks,I sent you an invite to the repo because it's private image

devjiwonchoi commented 5 months ago

@FairyPenguin hi, please try the latest remote-mdx@0.0.8, seem to work fine!

FairyPenguin commented 5 months ago

@FairyPenguin hi, please try the latest remote-mdx@0.0.8, seem to work fine!

Thanks worked like a charm, Appreciate your help and support 💙

Whenever you have time of-course, i need to understand something about this package it's having 3 main functions right? compileMDX, serialize and MDXRemote

I don't understand the difference between them until now,I'm only using the compileMDX and it's working do I need the other 2 functions and what they are for I don't know 🤦‍♂️

FairyPenguin commented 5 months ago

Another thing I noticed there is a small mistake in the docs

here there is a duplication for the MDXRemote the third one should be compileMDX

if you need me to do it as a pull-request just tell me.

devjiwonchoi commented 5 months ago

@FairyPenguin Hi, this package is currently a fork of next-mdx-remote, behaves the same as it is.

MDXRemote is a React Component that renders from a given MDX string, whereas compileMDX parses a given "possible MDX string" into two outputs: frontmatter and content.

I'd recommend you to take a look at here, since it describes well on your doubts. Feel free to ask more if that's not enough, I'd be happy to answer.

devjiwonchoi commented 5 months ago

here there is a duplication for the MDXRemote the third one should be compileMDX

Furthermore there's two MDXRemote on the example is because the MDXRemote differs between remote-mdx and remote-mdx/rsc, do you think we should add compileMDX as well for explaining it's a drop-in replacement?

devjiwonchoi commented 5 months ago

Closing this as resolved!

FairyPenguin commented 5 months ago

here there is a duplication for the MDXRemote the third one should be compileMDX

Furthermore there's two MDXRemote on the example is because the MDXRemote differs between remote-mdx and remote-mdx/rsc, do you think we should add compileMDX as well for explaining it's a drop-in replacement?

Yeah it will be better to add compileMDX

devjiwonchoi commented 5 months ago

@FairyPenguin Feel free to send a PR! Thanks 😄