# Resolving undefined errors while using map function in jsx.

```
If you are calling an api and stored data in useState. sometimes you may get an error called 'undefined' when you use map in your jsx.


ex: const [responseData, setResposeData] = useState();
    
axios.get('http://url').then(resp => {
    setResposeData(resp)
});

responseData.map((item)=>
//your code
)

then add ? it works like a try and catch block and avoids undefined errors.

responseData?.map((item)=>
//your htlml code
)

``` 

