Looking for beginner explanation for the following function that I have seen in an image picker example.
useEffect(() => {
(async () => {
const { status } = await Camera.requestPermissionsAsync();
setPermission(status === 'granted');
})();
},[]);
I know the empty array checks for updates to determine whether to re-render. I'm not exactly sure whether ()
is about the async function or cleaning up, but I know that the picker doesn't work without it.