Error in React Stateful list

I am facing an error in React Stateful list. It is not executing. This is the pictures of my code and error. Please resolve

Please respond sir I am waiting for your response

Hi @mayank.sharma,
In your App.js file, You have closed the round parenthesis after curly brackets. You have to place is after the return statement itself. Try this out.

setProducts((prevProducts) => {
    return [newProductData, ...prevProducts])
}

Let me know in case you need any help.


This is the error I am facing now.

Please respond sir I am waiting for ur response

Hi @mayank.sharma,
Please share your code so that we can have a look into it. Please provide the drive link of your code.

Sir I don’t know how to send the code to you.
Can’t u resolve using the screen shots of the code that I have shared you

Hi @mayank.sharma

The code snippet is as follows:

setProducts((prevProducts) => {
return [newProductData, …prevProducts]
})

Do try this and let me know if this works