SolidJSS
SolidJSโ€ข2y agoโ€ข
9 replies
TripleSmile

How to use a resource in a structure field as a reactive signal?

I am having serious skill issues and starting to lose my mind a bit.
Maybe someone has ideas how to make price reactive?
For now as far as I understand price field is created with NaN values because in the beginning of a page load I suppose the fetch is not yet executed because everything is async.

    const [productTitlePrice] = createResource("productTitle", fetchItemPrice);
    const [testRubberPrice] = createResource("testRubber", fetchItemPrice);

    const [productDataList, setProductDataList] = createSignal([
        {
            title: "productTitle",
            price: productTitlePrice(), //is not reactive
            photos: ["ash_001.JPG", "ash_002.JPG", "Placeholder.png"],
        },
        {
            title: "testRubber",
            price: testRubberPrice(), //is not reactive
            photos: ["example_003.JPG", "example_004.JPG", "Placeholder2.png"],
        },
    ]);
Was this page helpful?