그리고 UserMenuScreen 컴포넌트에서 방금 만든 컴포넌트를 다음과 같이 사용해보세요.
screens/UserMenuScreen.tsx
import {useNavigation} from '@react-navigation/core'; import React from 'react'; import {View} from 'react-native'; import MenuItem from '../components/MenuItem'; import {RootStackNavigationProp} from './types'; function () { const navigation = useNavigation<RootStackNavigationProp>(); const onLogin = () => navigation.navigate('Login'); const onRegister = () => navigation.navigate('Register'); return ( <View> <MenuItem name="로그인" onPress={onLogin} /> <MenuItem name="회원가입" onPress={onRegister} /> </View> ); } export default UserMenuScreen;