Skip to content

Instantly share code, notes, and snippets.

@surjithctly
Last active April 19, 2021 13:55
Show Gist options
  • Save surjithctly/8f34190a96952c262855c3de3397d06d to your computer and use it in GitHub Desktop.
Save surjithctly/8f34190a96952c262855c3de3397d06d to your computer and use it in GitHub Desktop.
JSX Cheatsheet
/**
I always forgot these simple JSX methods.
So I can refer this anytime.
Surjith S M / @surjithctly
**/
//---------------------------------------------------------------------
// Javascript map Function
{props.items.map((item) => {
// do logic here
return (
// return something here
)
})}
**/
//---------------------------------------------------------------------
// Javascript map Function Reduced Return
{props.items.map((item, _id) => (
<div>{item.title}</div>
))}
**/
//---------------------------------------------------------------------
// Javascript map Function One Line Return
{props.items.map((item, _id) => item.title)}
**/
//---------------------------------------------------------------------
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment