DEV Community

Scott Barrow
Scott Barrow

Posted on

data-reflex-root

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

Top comments (0)