Conversation
src/google_map_markers.js
Outdated
| this.dimesionsCache_ = {}; | ||
|
|
||
| const markers = React.Children.map(this.state.children, (child, childIndex) => { | ||
| if (!child) return null; |
There was a problem hiding this comment.
why null? why not undefined or why not a filter like util
There was a problem hiding this comment.
I've commented on the issue as well:
I've returned null if child is falsy. The resulting array is passed to react so no need to filter out them after map.
There was a problem hiding this comment.
Also, I can see this library being used with big amounts of markers, so minimising the amount of steps of intermediate array construction (with .map and .filter), might be a good thing.
There was a problem hiding this comment.
I don't like nulls ;-) the same result we will get with undefined.
So the question was about does null here has any advantage or hidden sense over undefined.
Having ES6 using null in any chain like env prevents me to use arguments defaults in the future, so I prefer not to use null at all.
So please change null on undefined ;-)
|
I've changed References: Early react didn't even have proper validation for undefined:
|
|
Thank you! |
|
npm 0.16.2 |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #203