Reputation: 7
The Code:
// Import libraries for making a Component
import React from 'react';
import ReactNative from 'react-native';
// Make a Component
const Header = () => {
return <Text>Albums!</Text>;
};
// Make the Component available to other parts of the App
export default Header;
And the image with the bug in the simulator:
Upvotes: 0
Views: 46
Reputation: 971
How about importing the Text
component from react-native. You can do that like so import { Text } from 'react-native'
Upvotes: 1
Reputation: 962
You need to import the Text component. Make sure that in the file where you have created the Text component that you export it. Once you have exported, you can write the following in the Header component file:
import Text from '/insert-path-to-Text-component/Text.js'
Also, since what you are returning inside the Header component is on one line, you don't need to wrap it in parenthesis.
Upvotes: 0
Reputation: 178
Text is component so you need to import it before using it. Still if that does not work then try following.
return (
<Text>Hello</Text>
);
Upvotes: 0