Created
June 17, 2018 06:50
-
-
Save devsumanmdn/e1018cb9f852bab0cf87eca5657293c6 to your computer and use it in GitHub Desktop.
What's the best way to define a functional stateless Component in react?
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
// Consider these two ways to define a functional stateless Component in react, | |
// which one is better and why? | |
// Or can suggest better also | |
//----------------------------------------------------------------------------- | |
// way 1 | |
const ComponentName = (props) => { | |
return ( | |
// Your JSX | |
); | |
}; | |
// way 2 | |
function ComponentName(props) { | |
return ( | |
// Your JSX | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment