Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Skip falsy markers#204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
istarkov merged 1 commit intogoogle-map-react:masterfromshark0der:master
Jul 24, 2016
Merged

Conversation

shark0der
Copy link
Contributor

Fixes#203

@@ -229,6 +229,7 @@ export default class GoogleMapMarkers extends Component {
this.dimesionsCache_ = {};

const markers = React.Children.map(this.state.children, (child, childIndex) => {
if (!child) return null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

why null? why not undefined or why not a filter like util

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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.

Copy link

@dapetcu21dapetcu21Jul 24, 2016
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't likenulls ;-) the same result we will get withundefined.
So the question was about doesnull here has any advantage or hidden sense overundefined.

Having ES6 usingnull in any chain like env prevents me to use arguments defaults in the future, so I prefer not to usenull at all.

So please change null on undefined ;-)

@shark0der
Copy link
ContributorAuthor

I've changednull toundefined as per request, however, you should keep in mind that null is generally more acceptable than undefined.

References:

Early react didn't even have proper validation for undefined:
facebook/react#1647

Therefore passing undefined may actually change behavior of underlying classes in confusing ways.

facebook/react#1668 (comment)

@istarkov
Copy link
Collaborator

Thank you!
(IMO bothnull andundefined should gone from all languages ;-))

@istarkovistarkov merged commitef1689e intogoogle-map-react:masterJul 24, 2016
@istarkov
Copy link
Collaborator

npm 0.16.2

@lock
Copy link

lockbot commentedDec 1, 2019

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.

@locklockbot locked asresolvedand limited conversation to collaboratorsDec 1, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Conditionally rendering marker
3 participants
@shark0der@istarkov@dapetcu21

[8]ページ先頭

©2009-2025 Movatter.jp