-
Notifications
You must be signed in to change notification settings - Fork 88
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
property: React not re-rendering when i change web component attribute #22
Comments
To clarify, if you set your property as something different than an object structure with import { property } from 'hybrids';
const myElement = {
chain: 'value',
// this equals to
chain: property('value'),
};
let myElement = document.getElementsByTagName('kutasiki')[0]
myElement.chain = 22; // <-- Use property, not attribute
// This is no longer needed, as render property can detect the change and re-render when needed
// myElement.render() Couple thoughts about your component example. I can see there, that you are using external CSS. If you want to create web component, which can be used with polyfills, you should avoid using import { render } from 'hybrids';
const MyElement = {
...,
render: render(
({ chain, ... }) => reactify(<div>...</div>),
{ shadowRoot: false },
),
}; One more thing 🤣 - you can't create a custom element without dash character in the tag name, even if is so funny as "kutasiki". |
I hope I could help. If there something more to discuss feel free to re-open issue. |
Thanks buddy - its working as expected now. |
I created a basic web component based on react. I do this:
`
`
and when i change a web component attribute manually in dev tools or via:
i doesnt rerender react component to consume up to date attributes. I'm missing something here?
The text was updated successfully, but these errors were encountered: