1import React from 'react';
2import {Text} from 'react-native';
3
4export default function Cat() {
5 return (
6 <Text>Hello, I am your cat!</Text>
7 );
8}
1// ES5
2var React = require('react');
3
4// ES6
5import React from 'react';
6
1/* ###### Import in React.js ###### */
2// Importing default export:
3import GIVEN_NAME from 'ADDRESS'
4
5// Importing named values:
6import { PARA_NAME } from 'ADDRESS'
7
8// Importing a combination of Default Exports and Named Values:
9import GIVEN_NAME, { PARA_NAME, ... } from 'ADDRESS'
1//Export single component in react.js
2import React from "react";
3
4function MyInfo() {
5 return (
6 <div>
7 <h1>Swapnil</h1>
8 <p>Hy this is Swapnil, I have no idea who I am</p>
9 <ul>
10 <li>Ladakh</li>
11 <li>Himachal Pradesh</li>
12 <li>Vellangiri Mountains</li>
13 </ul>
14 </div>
15 )
16 }
17
18export default MyInfo