-
I made 2 arrays of products which are set by the data from API.
-
1st one is ‘products’ and other one is ‘copyProducts’ because copyProducts will be used as reference to set the value of products after filtering them from a dropdown menu.
-
So I made that data in my context file to send it all over the app
-
I created the page for adding new products but the moment i use ‘setCopyProducts’ which is the setter function of ‘copyProducts’ the error shows “setCopyProducts is not a function” and it is showing ‘undefined’ when i import it from context.
-
i want to use ‘setCopyProducts’ to use it as a reference to set products value after getting filtered from a dropdown menu and to show a new category dynamically added in the dropdown menu.
Here is the repo of my Project
Click here
make sure to check these 4 files
I made 2 arrays of products which are set by the data from API.
The first one is products and the other one is copyProducts because copyProducts will be used as a reference to set the value of products after filtering them from a dropdown menu.
So I made that data in my context file to send it all over the app.
I created the page for adding new products, but the moment I use setCopyProducts, which is the setter function of copyProducts, the error shows “setCopyProducts is not a function” and it is showing ‘undefined’ when I import it from context.
I want to use setCopyProducts to use it as a reference to set products value after getting filtered from a dropdown menu and to show a new category dynamically added in the dropdown menu.