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

Why did you declare this code within the plugin? #168

Open
twoshlove opened this issue Jan 29, 2024 · 2 comments
Open

Why did you declare this code within the plugin? #168

twoshlove opened this issue Jan 29, 2024 · 2 comments

Comments

@twoshlove
Copy link

Why did you declare this code within the plugin?
I don't understand why ReactWebComponent.prototype.prop is defined because attributeChangedCallback seems to handle it correctly.

Object.defineProperty(ReactWebComponent.prototype, prop, {
  ....
}
@justinbmeyer
Copy link
Member

It's nice to be able to change the properties of the element directly. It's also the best way of sending data in the heap.

const someData = makeSomeData();

customElement = new MyCustomElementBuiltFromReact2WC();
customElement.data = someData;

@twoshlove
Copy link
Author

@justinbmeyer
Thanks for the kind explanation

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