SolidJSS
SolidJSโ€ข2y agoโ€ข
5 replies
ivan

how to efficiently make nested data structures in solid

Hello, I am new to Solid atm, but am aware of some reactivity principles like singals, memos, effects, etc. I was wondering what is the best way to go about implementing UI for a data structure that is nested (one of its elements is itself). For my usecase. I have an object called Questions. Each question can have sub-questions inside it , the object basically looks like this
const questions = {
   body: "", //the text inside the question, e.g. "when did x happen",
   id: 0, //just an id used for dynamic rendering keys,
   sub_questions: [questions] // an array of sub-questions, which all have the same body, id, sub_questions fields as their parent question structure
}

now, in theory, the Ui for a questions body shouldn`t update when its sub_questions update, but I am having trouble understanding how to implement something like this with signals, I come from React so I have never really actually used signals, so pls help me out. Any help is appreciated thank you
Was this page helpful?