In that scenerio;
1- if there is no array meaning userList is undefined or null we need to check before applying map function. In that case we can return [] so it will not broke the code.
2- If it is empty array meaning [] this should be ok because it is an Array instance so it will just return [].
Did this make it clear or you were asking something else
Yes that was clear, thank you!
I wanted to ask this question because when using useEffect, array or no array makes difference on rendering. Just wondering if that‘s the same with useMemo :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In that scenerio;
1- if there is no array meaning
userList
isundefined
ornull
we need to check before applying map function. In that case we can return[]
so it will not broke the code.2- If it is empty array meaning
[]
this should be ok because it is an Array instance so it will just return[]
.Did this make it clear or you were asking something else
Yes that was clear, thank you!
I wanted to ask this question because when using useEffect, array or no array makes difference on rendering. Just wondering if that‘s the same with useMemo :)