(11
(Choose 1 answer)
Study the code below and select the correct answer:
const Stack = createNativeStack Navigator();
function App() {
return (
<NavigationContainer>
<Stack.Navigator initial RouteName="Home">
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Details" component={Details Screen} />
</Stack.Navigator>
</NavigationContainer>
);
A. This code is correct and sets up the stack navigator. It contains two screens in the stack, Home and Details, with an initial route to the Home screen.
B. This code is incorrect. The stack navigator should not wrap the stack screens. You can also not specify an initial route name within the stack. This code will produce an error.
C. This code is correct and sets up the stack navigator. It contains two screens in the stack, Home and Details, with an initial route to the Details screen.
D. This code is correct and sets up the stack navigator. It contains two screens in the stack, Home and Details, with an initial route to the Home and Details screens.