Skip to content

Allow children to return HTML #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jpmonette opened this issue May 20, 2025 · 0 comments
Open

Allow children to return HTML #890

jpmonette opened this issue May 20, 2025 · 0 comments

Comments

@jpmonette
Copy link

I'm trying to generate RSS feed using reactElementToJSXString from a React element.

When I try to render the content of the blog post, it should look something like this:

<codearea>
  <![CDATA[ 
  <div> <p> my para </p> </div> 
  ]]>
</description>

However, it seems like all the HTML is transformed into a string:

<description>
{`<![CDATA[<div> <p> my para </p> </div> ]]>`}
</description>

My React code:

import type { JSONFeed } from "./feed-type";

export const RSS = (feed: JSONFeed) => (
  <rss version="2.0">
    <channel>
      {feed.items?.map((item) => {
        return (
          <item>
            <description>{`<![CDATA[${item.content_text}]]>`}</description>
          </item>
        );
      })}
    </channel>
  </rss>
);

Is it possible to have it rendered without being turned into a string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant