###### tags: `MERN`, `Debugging`, `JavaScript`
# MERN Common Errors
**Map is Not a Function**

.map function is **only** for arrays `[]` and this error occurs when the data you are iterating through is not a an array but another data structure like an object `{}`.
To fix this, we need to change our data type to an array `[]`. First step is to identify our **state** that holds the data.
<img src="https://i.imgur.com/wZYaDUZ.png" />
<img src="https://i.imgur.com/7iYeCd6.png" />
Here is an example of data pulling from our API:
<img src="https://i.imgur.com/wmuBVQh.png" width="150px"/>
Our error is in our setter:
<img src="https://i.imgur.com/k8RoDSj.png" />
Notice the DATA CONTAINS AN OBJECT CALLED DATA, AND AN ARRAY CALLED DATA INSIDE THE DATA OBJECT.
HERE IS THE FIX:

WE HAVE NOTATED CORRECTLY INTO THE BUCKET OF DATA, AND ARE NOW ABLE TO ITERATE OVER THE DATA BECAUSE IT IS NOW AN ARRAY
**this section up above is not finished**
---
ERROR -> "cannot find module..."

WHY?
Pathing Issues, Please check your folder structure which should look something like this below:


SOLUTION -> change your path url of the file you are trying to import by using dots and slashes, like this:
```
./config/mongoose.config
```
---