cferdinandi / reef

A lightweight library for creating reactive, state-based components and UI.
https://reefjs.com
MIT License
1.16k stars 77 forks source link

Modifying HTML after render #141

Closed Falkan3 closed 2 years ago

Falkan3 commented 3 years ago

Hello, I'm using Glide.js to mount onto an element, adding some inline styles and event listeners. It works as expected, but on every rerender, all attributes (including inline styles) are stripped, as they are compared using the diff function with template HTML, causing the carousel to break. To circumvent this, I need to reinitialize and mount on every rerender. Is there a better way to do this?

cferdinandi commented 3 years ago

Hi @Falkan3 - when using a state-based UI approach, you generally don't want to modify the HTML with other libraries after render (this is true of libraries like Vue or React as well).

That said, it might be worth me adding a reef-ignore attribute to support something like what you're doing. Leaving this open as a feature request.

cferdinandi commented 2 years ago

Closing this as won't fix, as reef v12 (now live) uses a more "mostly vanilla JS with a bit of progressive enhancement" approach.