HTML to React JS Basic Functions

Hey, this blog post was specifically written for the viewers of my youtube video. please check the video to get more understanding

Download Node : Link

Create new React app

npx create-react-app appname

 

React Functional Component

import React from 'react'

export default function About() {
  return (
    <div>About</div>
  )
}

 

Add Inline Style

<div style={{width: '18%',height:150,}}> </div>

 

React Router Dom

npm i react-router-dom



Import code 

import { BrowserRouter as Router, Routes, Route, useNavigate } from 'react-router-dom';

Sample App.js Source Code

import { BrowserRouter as Router, Routes, Route, useNavigate } from 'react-router-dom';

import Homepage from './app/Homepage';
import About from './app/About';
import Header from './app/Header';
import Contact from './app/Contact';

function App() {
  return (  
    <Router>
    <Header/>
    <div className="container">
      
      <h1> hello world</h1>

      <Routes>
        <Route  exact path='/' element={<Homepage />} />
        <Route  exact path='/about' element={<About />} />
        <Route  exact path='/contact' element={<Contact />} />
      </Routes>

    </div>  
    </Router>
  );
}

export default App;

 

Htaccess file for uploading cpanel

Create .htaccess file in your domain root directory

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]

 

 

Post Your Questions on our forum

Post a question on Forum

Ajith Jojo Joseph

Self taught, dedicated young entrepreneur with many licensed products under his sleeve. Passionate about technology, business and excellence in general.

Share with your friends:

Comments are closed.

Export html table to excel, pdf, csv format using Datatable

Do you know how to export html table to excel, pdf, CSV, or excel format using Datatable? If you don’t […]

August 4, 2022

Instagram Hashtag API PHP and JavaScript Integration with RapidAPI

Do you know how to integrate Instagram Hashtag API with your website? In this tutorial, I will show you how […]

August 2, 2022

How to host React Application into Cpanel – Routes not working Htaccess fix

Do you know how to host react applications into Cpanel? After building your react application. you will get an index.html […]

July 28, 2022

How to get user Public IP Address using Javascript

Do you know how to get the user IP address using javascript? I will show you how. Today we are […]

July 27, 2022

Digital Marketing Toolkit

Get Free Access to Digital Marketing Toolkit. You can use all our tools without any limits

Get Free Access Now