Subscribe on changes!

Attribute Inheritance: the root element of a jsx component does not inherit the 'id' attribute

avatar
Sep 26th 2022

Vue version

3.2.39

Link to minimal reproduction

https://codesandbox.io/p/github/zoeyzhao19/vue-jsx-issue/master?file=%2FREADME.md

Steps to reproduce

  1. start the project on codesandbox
  2. open the devtools and inspect the dom element render on the right side
  3. check if there is an id attributes on the root element of the JSX component and SFC component.

What is expected?

Both JSX component and SFC component's root element should have the id attribute

What is actually happening?

The SFC component's root element have the id attribute exactly, but the JSX component miss it.

System Info

No response

Any additional comments?

No response

avatar
Sep 26th 2022

Functional components do not automatically inherit any attributes, that is left to the author. they do not have a component instance, they are just functions creating vdom.