Open
Description
openedon Jul 24, 2024
Should this be an RFC?
- This is not a substantial change
Which package is this a feature request for?
React (@lit/react)
Description
The current react element wrapper sets many properties later, during a layout effect.
There is a short list of properties considered part of react that are assigned at element creation time:
const reservedReactProperties = new Set([
"children",
"localName",
"ref",
"style",
"className",
]);
This poses some trouble when porting lit elements that refer to each other by id
. For example:
<custom-element-a id="an-element"></custom-element-a>
<custom-element-b target="an-element"></custom-element-b>
Because the id is not set at first render, the element cannot be found in the connected callback phase of <custom-element-b>
Alternatives and Workarounds
I have made a fork of the custom element wrapper that treats the id property as a react property and sets it earlier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status