DOM elements duplicated on rerendering
See original GitHub issueSo I have couple of boilerplate projects which show how to use https://github.com/capaj/systemjs-hot-reloader with different frameworks. I wanted to get one for preact as well, but that proved harder than it should be. First reason was your custom jsx which I think I can solve with @guybedford but the other one which you might help me with was something that bit me when I rerender a preact app.
I have this very simple hello world app: https://github.com/capaj/jspm-preact/blob/master/public/app.js#L13
All it does is render Hello world. Now when render is called second time(because we reloaded some module and want to refresh the app) it actually appends another Hello world into my ‘app’ div element. I haven’t had any such behaviour with react. React render()
always deterministically returns same DOM, overwriting the current elements.
Do you have any reason that this is how preact render method behaves? If not, could you please align the behaviour with react? Then I could drop this little hack: https://github.com/capaj/jspm-preact/blob/master/public/app.js#L16
Thanks for consideration.
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (5 by maintainers)
Gee, wouldn’t it make more sense to make React’s behavior the default, and then change behavior if there is a third argument?
https://github.com/developit/preact/wiki/Differences-to-React#whats-different