parcel with preact: hot module reloading *appends* new html instead of replacing it.

Created on 24 Jan 2018  路  3Comments  路  Source: parcel-bundler/parcel

using parcel with preact:
when i edit a js file, hot module reloading appends the newly rendered html instead of replacing it.

how can i avoid that?
thx

Question

Most helpful comment

That's part of preact. See the note on render: https://preactjs.com/guide/differences-to-react#what-s-different-

To avoid, you can add a third argument to render like this:

const node = document.body;

render(<SomeApp />, node, node.lastChild);

All 3 comments

That's part of preact. See the note on render: https://preactjs.com/guide/differences-to-react#what-s-different-

To avoid, you can add a third argument to render like this:

const node = document.body;

render(<SomeApp />, node, node.lastChild);

@hobbes7878 thank you for the heads up and the link. very helpful.

parcel is out here, closing it.

I found this answer after a single Google search. this makes me happy.

Was this page helpful?
0 / 5 - 0 ratings