react {} import code example
Example 1: importing react
import React from 'react';
import ReactDOM from 'react-dom';
Example 2: import react
import React, { Component } from 'react';
Example 3: import library react js
// ---- REACT JS -----
// using
<link rel="shortcut icon" href="%PUBLIC_URL%/js/bootstrap.min.js"> </link>
<script src="%PUBLIC_URL%/js/bootstrap.min.js"> </script>
// public
// --- js
// ------ bootstrap.min.js
// --- css
// ------ bootstrap.min.css
Example 4: react export
import React from 'react';
import {Text} from 'react-native';
export default function Cat() {
return (
<Text>Hello, I am your cat!</Text>
);
}
Example 5: export component in
//Export single component in react.js
import React from "react";
function MyInfo() {
return (
<div>
<h1>Swapnil</h1>
<p>Hy this is Swapnil, I have no idea who I am</p>
<ul>
<li>Ladakh</li>
<li>Himachal Pradesh</li>
<li>Vellangiri Mountains</li>
</ul>
</div>
)
}
export default MyInfo