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]
Share with your friends:
Google Auth in android and ios with React native Expo Managed workflow
Hey , Recently i striggled alot to find a way to integrate the google auth with react native expo app. […]
October 3, 2024
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
Digital Marketing Toolkit
Get Free Access to Digital Marketing Toolkit. You can use all our tools without any limits
Get Free Access Now