Posts

Showing posts from May, 2024

Dynamically Change width and height of Div using CSS and React

         const [ size_w , setSize_w ] = useState ( '210mm' );      const [ size_h , setSize_h ] = useState ( '297mm' ); /////////////   const changelayout = () => {             const temph = size_h === '210mm' ? '297mm' : '210mm' ;             const tempw = size_w === '297mm' ? '210mm' : '297mm'             setSize_h ( temph );             setSize_w ( tempw );     } //////////////////// < button className = "bg-blue-500 text-white px-4 py-2 mr-2 rounded" onClick = { changelayout } > Change Layout </ button > ////////////// < div ref = { contentToPrint } id = "printable-content" style = { { width : size_w , height : size_h } } className = "print-content p-4 bg-white" > </div>

Convert Object to Array in JavaScript

 https://www.linkedin.com/pulse/7-ways-convert-objects-array-javascript-awais-al-waisy

Manage Dynamically Created Component in React

Dailywork.js ////////////////////////////////// import React ,{useState, useEffect} from "react"; import axios from "axios"; import Dailyworkdetails from './Dailyworkdetails' import Reacttoexcel from "./Reactttoexcel"; import dayjs from "dayjs"; function Dailywork(){     const [holyday,setHolyday]=useState([])     const [batchinfo,setBatchinfo]=useState([])     const [coursehinfo,setCourseinfo]=useState([])     const [filterbatchDetails,setFilterbatchDetails]=useState([])     const [selectedCourse, setSelectedCourse] = useState("");     const [selectedBatch, setSelectedBatch] = useState("");     const [tempbatch,setTempbatch]=useState()     useEffect(()=>{         axios.get('http://127.0.0.1:8000/batchlist/')         .then((res)=>{setBatchinfo(res.data);})         .catch((error) => {             console.error("...