Skip to content

children in Syntax Highlighter showing as object Object #1337

Closed Answered by kartikm7
kartikm7 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @ChristianMurphy ! I actually just figured out why I needed to serialize, this was because I was using both rehype-highlight and react-syntax-highlighter. So this is what I think must be happening, rehype-highlight would pre-process the code block and convert some of the string to React Nodes and when I'd convert the children prop of the code-block to String and drill the prop to my custom Code component(which uses react-syntax-highlighter) that would cause react-syntax-highlighter to get a string with [object Object]. Removing rehype-highlight fixed this issue for me.

Thank you so much for being kind, and trying to help me out here!

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ChristianMurphy
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by kartikm7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
🙉 open/needs-info This needs some more info
2 participants