Await list data (instead of single value) #434
-
Hi, Anyway, it seems the Await component handles a single value. What if I want to fetch a json object with a list? I don't know how to write simple code for this, I'm not good enough in async code. So each item in the list should render something like li({class:"something"}, listItem.value) if possible, or any other way of creating the async list. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
When looking further into this, it seems to me that it's much easier to separate async and html components completely. An async function can be created and only change a state variable. The html component is then built, without any async, based on the state variable. |
Beta Was this translation helpful? Give feedback.
-
For |
Beta Was this translation helpful? Give feedback.
For
Await
component, you specify achildren
parameter with function type(data: T) => ValidChildDomValue
. Thus you can fetch anything inAwait
- lists, complex json objects, etc, as long as yourchildren
parameter takes the thing you fetched as input.