Last active
April 19, 2021 13:55
-
-
Save surjithctly/8f34190a96952c262855c3de3397d06d to your computer and use it in GitHub Desktop.
JSX Cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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