Q28.webp
Kechizu76

Q28.webp

Kizspy Question: 28
(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 { uselsFocused } from '@react-navigation/native';
function ProfileScreen() {
const isFocused
useEffect(() => {
if (isFocused) {
usels Focused();
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
  • Like
Reactions: Kiru

Thông tin

Category
MMA301
Thêm bởi
Kechizu76
Ngày thêm
Lượt xem
2,592
Lượt bình luận
15
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom