Created
June 12, 2020 22:46
-
-
Save ltsharma/270ac708d7e1a32b6c377d7776760061 to your computer and use it in GitHub Desktop.
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
const AwesomeChild =({text,style})=>{ | |
return( | |
<Text style={style} >{text}</Text> | |
) | |
} | |
const areEqual=(prevProps,nextProps)=>{ | |
// return false prevProps.text & nextProps.text are not equal. | |
return prevProps.text===nextProps.text | |
// else all are equal, no re-render | |
return true | |
} | |
export default React.memo(AwesomeChild,areEqual) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment