Alewa's avatar
Level 2

React adding of multiple array object in the database using laravel api

I am getting this error Uncaught (in promise) ReferenceError: size is not defined when am adding my product atrributes.

ProductController.php file for my api

ViewProductAttributes.jsx file

I know the problem is comming from this code in my ViewProductAttributes.jsx file

// console.log("productAttribute", productAttributeInput);
const Formdata = {
            size,
            sku,
            cost_price,
            sales_price,
            stock,
        };

Because when I console the productAttributeInput, I get the data in my console perfectly, but if someone can help me on how to insert that data into my database, that is where the problem is.

0 likes
0 replies

Please or to participate in this conversation.