reshape/preact-components

ability to pass an entire object to a component

Closed this issue · 2 comments

would be good to be able to do

<my-component state='stateObj' />

instead of individually like

<my-component state-title="foo" state-description="bar" />

It definitely would, but this is an html parsing issue. Basically, if there is a double quote in your object, html parsers will treat it as the end of the attribute value, and everything will get messed up. And unfortunately, it's really difficult to ensure that there are no double quotes anywhere inside your object, especially when consuming content from a CMS.

One solution it to encode to base64 and decode on the other end -- it's possible we could build in some shortcut functions for this that could be pulled from this library. This is the way that we handle the initial state hydration, and it seems to work ok. Any thoughts on this?

closed by 33a000c