MMA301_-_SU_2024_-_FE_2248.webp
T

MMA301_-_SU_2024_-_FE_2248.webp

(Choose 1 answer)
Consider the following component using usels Focused and useEffect. What will be the behavior if the component is initially unfocused and then gets focused?
import React, { useEffect } from 'react';import {Text} from 'react-native';
import { usels Focused } from '@react-navigation/native';
function ProfileScreen() { const is Focused = usels Focused();
useEffect(() => {
if (isFocused) {
console.log('ProfileScreen is now focused');
} }, [isFocused]);
return <Text>Profile Screen</Text>;
}
A. It will log 'ProfileScreen is now focused' every time the component is rendered
B. It will log 'ProfileScreen is now focused' only once when the component mounts
C. It will log 'ProfileScreen is now focused' every time the component gains focus
D. It will log 'ProfileScreen is now focused' every time the component is unfocused
FUO
2: 1

Thông tin

Category
MMA301
Thêm bởi
Thái Bảo1
Ngày thêm
Lượt xem
6,000
Lượt bình luận
22
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
MMA301_-_SU_2024_-_FE_2248.webp
File size
289.1 KB
Dimensions
1920px x 892px

Share this media

Back
Bên trên Bottom