4 ms·
> since you can't pass complex objects as attributes like you can in jsx But you can! Here's an example of passing complex objects as attributes (look for zx-
by breadwinner 3y ago
> since you can't pass complex objects as attributes like you can in jsx
But you can!
Here's an example of passing complex objects as attributes (look for zx-listeditor):
https://github.com/wisercoder/uibuilder/blob/master/WebComponentsDemo/Views/DemoPage.tsx https://github.com/wisercoder/uibuilder/blob/master/WebCompo...
And here's the web component itself:
https://github.com/wisercoder/uibuilder/blob/master/WebComponentsDemo/elements/ZxListEditor.tsx https://github.com/wisercoder/uibuilder/blob/master/WebCompo...
And here's the tiny (500-line) lib that enables it:
https://github.com/wisercoder/uibuilder/#jsx-for-web-components https://github.com/wisercoder/uibuilder/#jsx-for-web-compone...
- crooked-v 3y ago"You can pass complex objects using web components, if you also use something other than web components" isn't really all that much of a defense of web components.
- breadwinner 3y agoIt is 223 lines of code: https://github.com/wisercoder/uibuilder/blob/master/dist/uibuilder-1.7.0.js https://github.com/wisercoder/uibuilder/blob/master/dist/uib... You object to this tiny amount of code?
- skrebbel 3y agoHow do you make this work with frameworks like Svelte which, when server side rendering, cast all props to string (!) attributes?
- breadwinner 3y agoThat should be an easy bug fix in Svelte.