Which hook in React Navigation 5 supports handling deep linking in the application?
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "useLinking". Ở React Navigation 5, hook useLinking dùng với container điều hướng để lắng nghe URL mở ứng dụng, đối chiếu với prefixes và cấu hình ánh xạ đường dẫn sang màn hình rồi điều hướng tới đúng nơi, tức là xử lý deep linking (liên kết sâu); các bản sau chuyển phần này thành prop linking của NavigationContainer. "useScrollToTop" làm danh sách cuộn lên đầu khi bấm lại tab đang mở. "useRoute" trả về đối tượng route của màn hình hiện tại để đọc name và params. "useNavigation" trả về đối tượng navigation cho component không phải màn hình, để gọi navigate hay goBack.
Cùng chương 5
Consider the following component using useIsFocused 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 { useIsFocused } from '@react-navigation/native';
function ProfileScreen() {
const isFocused = useIsFocused();
useEffect(() => {
if (isFocused) {
console.log('ProfileScreen is now focused');
}
}, [isFocused]);
return <Text>Profile Screen</Text>;
}Có lời giảiCâu hỏiWith hook in React Navigation, what will happen if you call useFocusEffect inside a functional component but provide an empty dependency array?Có lời giảiCâu hỏiIn React Navigation, which hook should you use to get access to route parameters inside a functional component?Có lời giảiCâu hỏiCả 24 câu của chủ đề24 câu