DEV Community

loading...

data-reflex-root

scottbarrow profile image Scott Barrow ・1 min read

If you’re finding janky animations or renders with elements when using reflexes with self-referential data-reflex-root, wrap the children of your root element in a div/span
This helps morphdom…morph
Janky:

<div id='some-id' data-reflex-root='#some-id'>
  some text
  <input data-reflex= 'click->SomeReflex#some_action'>..</div>
</div>
Enter fullscreen mode Exit fullscreen mode

Not janky

<div id='some-id' data-reflex-root='#some-id'>
  <div>
    some text
    <input data-reflex= 'click->SomeReflex#some_action'>..</div>
  </div>
</div>
Enter fullscreen mode Exit fullscreen mode

YMMV

Discussion (0)

Forem Open with the Forem app