using same component for different route path in react-router v6

Using different key for each route should force components to rebuild: import React, { Component } from ‘react’;import Navbar from ‘./Components/Navbar’;import News from ‘./Components/News’;import Test from ‘./Components/Test’;import NoMatch from ‘./Components/NoMatch’;import { BrowserRouter , Route, Routes } from ‘react-router-dom’export default class App extends Component { render() { return <div> <BrowserRouter> < Navbar /> <Routes> <Route path=”/” element={<News pageSize={8} …

using same component for different route path in react-router v6 Read More »

Add GitLab SSH Key

1. Update System sudo apt update sudo apt upgrade 2. Install git on local machine sudo apt install git 3. Check git version git –version 4. Git Configure in your localmachine git config –global user.name “your name” git config –global user.email “your email id” 5.Check your configuration git config –list 6. Generate SSH Key ssh-keygen …

Add GitLab SSH Key Read More »

Use React Router Dom V6

   install latest versionnpm install react-router-dom For v6 use belowimport React, { Component } from ‘react’;import Navbar from ‘./Components/Navbar’;import News from ‘./Components/News’;import { BrowserRouter as Router, Route, Routes } from ‘react-router-dom’export default class App extends Component { render() { return <div> <Router> < Navbar /> <Routes> <Route exact path=”/” element={<News pageSize={8} category=”general”/>}/> <Route exact path=”/business” …

Use React Router Dom V6 Read More »

fixed ‘Switch’ is not exported from ‘react-router-dom’

  I also faced the same problem, and I searched the Internet so much, but I didn’t get any answer according to my question. So I uninstalled version 6 of react-router-dom: npm uninstall react-router-dom And installed version 5.2.0 of react-router-dom: npm install [email protected] use below import { BrowserRouter as Router, Switch, Route, Link} from “react-router-dom”;export …

fixed ‘Switch’ is not exported from ‘react-router-dom’ Read More »

js fetch

 let headersList = {  “Accept”: “*/*”,  “User-Agent”: “Thunder Client (https://www.thunderclient.com)” } fetch(“https://newsapi.org/v2/everything?q=ipl&from=2022-01-07&sortBy=publishedAt&apiKey=739ea6a82b1f4818a21c8aa2441545c0”, {    method: “GET”,   headers: headersList }).then(function(response) {   return response.text(); }).then(function(data) {   console.log(data); })

nodejs multiple module exports

Module file file name – operator.js const add = (a, b)=>{ return a +b ; } const sub = (a, b)=>{ return a – b ; } const name =‘kanha’; module.exports = {add, sub , name}; index file – where you are importing the modules  filename = index.js const op = require(‘./operator’); console.log(op.add(2,5)); console.log(op.sub(2,5)); console.log(op.name);

ALL HTTP Status Code

100 Continue101 Switching Protocols103 Early Hints200 OK201 Created202 Accepted203 Non-Authoritative Information204 No Content205 Reset Content206 Partial Content300 Multiple Choices301 Moved Permanently302 Found303 See Other304 Not Modified307 Temporary Redirect308 Permanent Redirect400 Bad Request401 Unauthorized402 Payment Required403 Forbidden404 Not Found405 Method Not Allowed406 Not Acceptable407 Proxy Authentication Required408 Request Timeout409 Conflict410 Gone411 Length Required412 Precondition Failed413 Payload …

ALL HTTP Status Code Read More »