Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should render ReactNode in connectedCallback not constructor? #16

Open
WeiRu1016 opened this issue Nov 4, 2021 · 2 comments
Open

should render ReactNode in connectedCallback not constructor? #16

WeiRu1016 opened this issue Nov 4, 2021 · 2 comments

Comments

@WeiRu1016
Copy link

image

in constructor create and render ReactNode, let we can't setProps before render ReactNode.
because HTML attr is not support Camel-Case。

so create and render ReactNode in connectedCallback better

@kopach
Copy link
Collaborator

kopach commented Dec 6, 2021

Hi @WeiRu1016. Thanks for using this lib and your contribution to this project. Would you be able to create an example with described issue in https://codesandbox.io/ or similar?

@WeiRu1016
Copy link
Author

WeiRu1016 commented Mar 4, 2022

sorry, This is demo: https://codesandbox.io/s/react-web-component-ugmyj9?file=/src/index.tsx

because textValue is camel-case props, html5 attributes is not support camel-case attributes.
so use setProps.

but before setProps, react component has created and mounted. props textValue is required props, but now is undefined.

if ExampleComplete used textValue to acc, will cause render error!!!

I suggest renderRender2Node is move to connectedCallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants