Skip to content

Instantly share code, notes, and snippets.

@itsMapleLeaf
Last active June 9, 2021 04:18
Show Gist options
  • Select an option

  • Save itsMapleLeaf/23dbfd30765c0bc9a64050d3aa02184a to your computer and use it in GitHub Desktop.

Select an option

Save itsMapleLeaf/23dbfd30765c0bc9a64050d3aa02184a to your computer and use it in GitHub Desktop.
js arrow function syntax
// good
items.map(item => {
return <div />
})
// good - implicit return, doesn't require curly braces {} or return keyword
items.map(item => <div />)
// good - using parens when on multiple lines is a common convention
items.map(item => (
<div />
))
// bad - when using curly braces, a return is needed
// here, the div just gets ignored and you map to an array full of `undefined`s
items.map(item => {
<div />
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment