const handlePress = useCallback(() => {
// handle press
}, [])
<Button onPress={handlePress} />
| useEffect(fn) // run function on every render | |
| useEffect(fn, []) // run function only when the component is first rendered | |
| useEffect(fn, [value]) //run function when component is first rendered and when the `value` changes | |
| // Remember if you pass dependency(value) which is an object - React perform | |
| // strict comparision using "===" of the first level properties and will not | |
| // conduct comparisons deeper into the properties. |
This is for my personal use, things might not be correctly explained here. For the official docs please check https://github.com/airbnb/react-native-maps
Steps from scratch:
1.react-native init GoogleMapPlayground
| /* | |
| Copyright (c) 2015 Kristopher Johnson | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to | |
| permit persons to whom the Software is furnished to do so, subject to | |
| the following conditions: |