Last active
June 13, 2020 09:30
-
-
Save ltsharma/1be2903c9cfa0e6b0003c454f7b18bfb 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
export default ()=>{ | |
const [childState, setChildState] = useState(0); | |
//using useCallback | |
const awesomeChildListRenderItem = useCallback( | |
({ item }) => ( | |
<AwesomeChild {...item} onPress={(number)=>{setChildState(number)}} /> | |
),[]); | |
const awesomeChildListKeyExtractor = useCallback( (item) => `awesome-child-key-${item.id}`,[]); | |
return( | |
<FlatList | |
renderItem={awesomeChildListRenderItem} | |
keyExtractor={awesomeChildListKeyExtractor} | |
/> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment