I have a hard time to render List of custom types within the view function. This is the model:
type alias Guid = String
type alias User = String
type alias TaxonomyCategory =
{ id : Guid
, name: String
, updatedAt: Date
, updatedBy: User
, terms: List TaxonomyTerm
}
type TaxonomyTerm =
TaxonomyTerm
{ id : Guid
, name: String
, terms: List TaxonomyTerm
}
I tried several approaches with List.map function but I always ended up with some kind of error message.
The 2nd argument to function `ul` is causing a mismatch.
120| ul
121| []
122|> [ List.map renderTaxonomyTerm tc.terms ]
Function `ul` is expecting the 2nd argument to be:
List (VirtualDom.Node a)
But it is:
List (List (Html a))
The second parameter of ul
should be a list of Html elements. Your second value contains a list within a list since you surrounded it with brackets. Changing it to this should fix your problem:
ul
[]
(List.map renderTaxonomyTerm tc.terms)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With