solidjs/html use: attributes

What's the correct syntax for use: attributes when using lit-dom-expressions ? I've tried html`<div use:${myFunction}></div>` but that doesn't work and any properties following the use: are omitted.
4 Replies
webstrand
webstrandOP4w ago
it doesn't work when I pass a value, either html`<div use:${myFunction}="example"></div>` I'm using this API because I'm wanting to use solidjs to build the UI for a greasemonkey script
mdynnl
mdynnl4w ago
i think it's a bug, before this is solved you could workaround to ref it's essentially the same thing
webstrand
webstrandOP4w ago
I can't test right now, but can I have multiple ref? I think that's the primary advantage of use: can workaround obviously by mapping over callbacks, but it's got more syntax
mdynnl
mdynnl4w ago
yeah, something like this could help a little bit
html`<div ref=${use(fn, [fn, () => 4])} />`
html`<div ref=${use(fn, [fn, () => 4])} />`
solid doesn't actually care if you pass some prop multiple times so multiple ref also works
Want results from more Discord servers?
Add your server