Editing the generated content of React after build

695 views Asked by At

I'm using react-snap to pre-generate my website content instead of client side rendering.

After building the project, when I manually edit index.html, the changes only get applied if the edited elements are outside <div id="root"/>.

I can add scripts and meta tags to the <head/> or to the bottom of <body/>; but nothing happens when I edit the content of <div id="root"/>. When I inspect the site the contents have not changed but the code inside html file is different.

What is causing this behavior and how can I bypass it?

1

There are 1 answers

1
Király Roland On

Why do you need to edit index.html? By default, create-react-app uses index.html as a fallback.

Make sure you're not using self-closing tags like this: <div id="root"/>

and replace with this:

<div id="root"> </div>