Next.js Discord

Discord Forum

Rendering

Unanswered
Siamese posted this in #help-forum
Open in Discord
SiameseOP
Hi there, I have a .html file which I want to render on a page.tsx.
I need to do it like this because before the .html is rendered, I want to show a popup.
What should I do for the html to be rendered?

7 Replies

@Siamese Hi there, I have a .html file which I want to render on a page.tsx. I need to do it like this because before the .html is rendered, I want to show a popup. What should I do for the html to be rendered?
you can import the html file as string https://github.com/joulev/debug/tree/import-file-as-string and use it inside dangerouslySetInnerHtml i suppose.

that's the how. now i want to know the why – isn't it a lot better and more convenient to use a react component instead of raw html?
They are created with react and saved to a .html page
And probably there isn't much that can be done when it comes to migrating the files from html to react components
SiameseOP
@joulev I think JS doesnt execute like that
Does this work on a client component?
SiameseOP
I kinda got it to work on a server component, but then there are problems with the popup, I will try to make the popup as a second component