Ecommerce Shopify WordPress Discussion

Imported function is not a function react – Shopify app development

I am in the process of building a simple Shopify app using the remix app template. I've managed to set up the prisma schema okay and add some basic data to one of the tables. I now wanted to update the DB based on a checkbox being toggled. So for instance, checkbox toggle runs a function, updates DB and the updates state. Here is the code that runs the import import { getDelivery } from "../models/delivery.server"; import { updateDelivery } from "../models/delivery.server"; Here is the action function ran on checkbox tick export async function action({request}) { const deliveryDetails = await updateDelivery(Number(1)); }; Here is the updateDelivery function loaded from the delivery.server.js file import db from "../db.server"; export async function getDelivery(id) { console.log("got to this function") const deliveryDetails = await db.deliveryDate.findFirst({ where: { id } }); if (!deliveryDetails) { return null; } else { console.log("hit the return delivery") console.log(deliveryDetails) return deliveryDetails; } } export async function updateDelivery(id) { console.log("hit the update function") const data = { "shop": "Test", "deliveryOn": false } const deliveryDetails = await db.deliveryDate.update({ where: { id: id }, data }); if (!deliveryDetails) { return null; } else { console.log("hit the update delivery") console.log(deliveryDetails) return deliveryDetails; } }; Here is how I call it <Checkbox label="Add delivery box to UI" checked={checked} onChange={action} /> So onchange should call action which in turn hits the update delivery function, it should update DB with updated details. However it when it hits the action function I get Uncaught (in promise) TypeError: (0 , import_delivery2.updateDelivery) is not a function What I don't understand is why the getDelivery function fires fine and returns the initial data but the update won't work.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.