Skip to main content

Posts

Showing posts from January, 2023

React JS Interview Q & A

1. What is DOCTYPE in HTML? DOCTYPE is an instruction that is used in the beginning of an HTML or XHTML document to inform a web browser about the version and type of HTML or XHTML being used. It is not an HTML tag; it is an "information" to the browser about what document type to expect. It is important to include the DOCTYPE in your HTML documents in order for the browser to correctly render the content of your web page. 2.What are the new HTML5 features? Semantic Elements: HTML5 introduces new semantic elements like <header>, <nav>, <article>, <section>, <aside>, <figure> and <figcaption>, which provide additional meaning to the content of a web page. Audio and Video Support: HTML5 includes built-in support for audio and video, eliminating the need for third-party plugins like Flash. Canvas: HTML5 introduces the <canvas> element, which allows for dynamic, scriptable rendering of 2D shapes and bitmap images. Web Storage: HTML5...

How to access baarer tocken after login in react js

 How to access baarer tocken after login in react js i have set my token in local  storage as keyname : @token we can use that token after API as second parameter     useEffect(() => {     const fetchallclient = async () => {       try {         const res = await axios.get( 'http://164.92.124.108/api/getallclients' , {           headers: {             Authorization: `Bearer ${localStorage.getItem('@token')}`,           },         })         setDatalist(res?.data?.data)         console.log(res, 'fff' )       } catch (err) {         console.log(err)       }     }     fetchallclient()   }, [])

Login API with Token in reactjs

Login API with Token in reactjs  import React, { useState } from 'react' import { Link, useNavigate } from 'react-router-dom' import axios from 'axios' import {   CButton,   CCard,   CCardBody,   CCardGroup,   CCol,   CContainer,   CForm,   CFormInput,   CInputGroup,   CInputGroupText,   CRow, } from '@coreui/react' import CIcon from '@coreui/icons-react' import { cilLockLocked, cilUser } from '@coreui/icons' import { setUserSession } from 'src/Utils/Common' // import { response } from 'express' const Login = (props) => {   const navigate = useNavigate()   const [MailID, setMailID] = useState( '' )   const [Password, setPassword] = useState( '' )   const [error, setError] = useState( null )   const [loading, setLoading] = useState( false )   const handleLogin = () => {     setError( null )     setLoading( true )     axios     ...