SolidJSS
SolidJSโ€ข15mo agoโ€ข
5 replies
snorbi

Reactive array transformation

What is the correct way to make the result of a filtering+mapping operation on an array reactive?
  return store.productTreeData
    .filter(e => e.parentId == parentId)
    .map(e => {
      const children = ...
      return { productTreeItem: e, children: children.length > 0 ? children : null };
    });

What should I write instead of the object literal?
What I would like to do is to refactor some code to separate functions but the result to remain "reactive".

Thanks.
Was this page helpful?