Question: 31
(Choose 1 answer)
Consider the following code using uselsFocused:
import React, {useEffect } from 'react';
import { Text } from 'react-native';
import { uselsFocused} from '@react-navigation/native';
function HomeScreen() {
}
const is Focused
useEffect(() => {
if (is Focused) {
usels Focused();
console.log('HomeScreen is focused');
} else {
console.log('HomeScreen is not focused');
}, [isFocused]);
return <Text>Home Screen</Text>;
What will be logged if the component is initially focused and then loses focus?
A. 'HomeScreen is focused' initially, followed by 'HomeScreen is not focused'
B. 'HomeScreen is focused' only
C. 'HomeScreen is not focused' only
D. 'HomeScreen is not focused' initially, followed by 'HomeScreen is focused'