You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But when I use it in the code below, I get a compiler error:
Generic struct 'Grid' requires that '_HTMLTuple2<Row<p<HTMLText>>, Row<p<HTMLText>>>' (aka '_HTMLTuple2<Row<HTMLElement<HTMLTag.p, HTMLText>>, Row<HTMLElement<HTMLTag.p, HTMLText>>>') conform to 'RowsHTML'
Which I think means that it wants everything inside Row to be RowsHTML as well. And that seems excessive, having to add that protocol to every html element.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to create something called
Grid
which initializes with only one or moreRow
.So far this is what I came up with...
But when I go to use
Grid
I have to put theRow
s into an array like so...I'd prefer to compose the
Row
s like any other HTML.But if I use
... it will allow any HTML and not just
Row
s.Is there a way to write an HTMLBuilder func parameter like this?
And then I can write
Grid
more naturally without arrays like below and onlyRow
s are allowed...First I tried creating a new protocol on top of
HTML
calledRowsHTML
.And then used that to restrict what is supplied to
Grid
.But when I use it in the code below, I get a compiler error:
Generic struct 'Grid' requires that '_HTMLTuple2<Row<p<HTMLText>>, Row<p<HTMLText>>>' (aka '_HTMLTuple2<Row<HTMLElement<HTMLTag.p, HTMLText>>, Row<HTMLElement<HTMLTag.p, HTMLText>>>') conform to 'RowsHTML'
Which I think means that it wants everything inside
Row
to beRowsHTML
as well. And that seems excessive, having to add that protocol to every html element.Is there another way to approach this?
Beta Was this translation helpful? Give feedback.
All reactions