You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the custom element class has any of those as properties (passes our in check), we set them on the instance rather than pass to React, which might be unexpected.
We could add to the list to reactReservedProperties set which will always pass to React, but if the property is meant to be publicly settable on the custom element, that might then be worse. Our in check can't know the intention. At the very least, adding a dev mode warning could be helpful.
Alternatives and Workarounds
Make sure all internal properties/methods of custom element classes do not conflict with React built-in props. _ prefix or making them private with # are good practices.
The text was updated successfully, but these errors were encountered:
Should this be an RFC?
Which package is this a feature request for?
React (@lit/react)
Description
Brought up by @stefanpearson here #4569 (comment)
React developers using the wrapped components may have expectation that these built-in common props listed here https://react.dev/reference/react-dom/components/common#common would have specific behavior.
If the custom element class has any of those as properties (passes our
in
check), we set them on the instance rather than pass to React, which might be unexpected.We could add to the list to
reactReservedProperties
set which will always pass to React, but if the property is meant to be publicly settable on the custom element, that might then be worse. Ourin
check can't know the intention. At the very least, adding a dev mode warning could be helpful.Alternatives and Workarounds
Make sure all internal properties/methods of custom element classes do not conflict with React built-in props.
_
prefix or making them private with#
are good practices.The text was updated successfully, but these errors were encountered: