Skip to content

Any recommendations on how to structure complex data? #318

Discussion options

You must be logged in to vote

Depends on how granular you want to react to changes to todo items. There is no right or wrong approach here. With signals I notice that my own thinking shifted from "when/how do I update things" to "when do I need to sync with the UI".

In your example you wrapped each todo item with a signal:

const todos = signal([
  signal({ text, done }),
  signal({ text, done })
])

That works too, and there is nothing wrong with that approach. Only minor annoyance with that is, that whenever you update a todo's .done property, the code that renders the text always needs to be updated too. What's more is that you likely mapped over the list and rendered the items in the same component, which would subs…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by JoviDeCroock
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@marvinhagemeister
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants
Converted from issue

This discussion was converted from issue #93 on March 07, 2023 12:10.