Posts

Showing posts from July, 2024

IMPORTANT JS

 https://www.geeksforgeeks.org/how-to-add-a-parameter-to-the-url-in-javascript/ https://www.w3schools.com/howto/howto_js_redirect_webpage.asp

php work

 https://www.youtube.com/watch?v=UbJbLyDrpsk

flatlist react native

  import { StatusBar } from 'expo-status-bar' ; import { useState } from 'react' ; import { Button , FlatList , ScrollView , StyleSheet , Text , TextInput , View } from 'react-native' ; // import { LinearGradient } from 'expo-linear-gradient'; export default function App () {   const [ goal , setgoal ] = useState ( '' );   const [ CourseGoal , setCourseGoal ] = useState ([]);   const goalInputHandler = ( enterdText ) => {     // console.log(enterdText); setgoal ( enterdText );   }   const addGoalHandler = () => {     // console.log(goal);     setCourseGoal ( prevGoal => [ ... prevGoal ,{ text : goal , id : Math . random (). toString ()}]);     // console.log(CourseGoal);   }   return (         < View style = { styles . container } >       { /* <View style={styles.container1}>       <Text>good morning sir</Text...

colorchange

 linear-gradient(173.91deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 95.18%)

updatequery react query

 // MyForm.js import React from 'react'; import { Formik, Form, Field } from 'formik'; import * as Yup from 'yup'; import { useMutation } from 'react-query'; import axios from 'axios'; const MyForm = () => {   // Define your form schema using Yup   const validationSchema = Yup.object({     name: Yup.string().required('Required'),     email: Yup.string().email('Invalid email address').required('Required'),   });   // Define the mutation for posting data   const mutation = useMutation((newData) => {     return axios.post('https://example.com/api/data', newData);   });   return (     <Formik       initialValues={{ name: '', email: '' }}       validationSchema={validationSchema}       onSubmit={(values, { setSubmitting }) => {         mutation.mutate(values, {           onSuccess: () => {      ...

button click color change after some interval

  <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > Document </ title > </ head > < body >         < p > hello </ p >     < p > good morning </ p >     < p > good afternoon </ p >     < p > good night </ p >     < button > click </ button >     < script >         document . querySelector ( 'button' ). addEventListener ( 'click' , function (){             para = document . querySelectorAll ( 'p' );             //loop:-             for ( let i = 0 ; i < para . length ; i ++){               ...

why promise js

placeholder :container for future value[eventual completion of async operation] an object representing eventual compltetion of async operation  const cart=["shoes","pants","kurta"]; //passing the function createOrder(cart,function(orderId){ proceedToPayment(orderId);//this is different api how u know it will call  //or how many times it will call }); const promise=createOrder(cart); promise is an object with  empty value {data:undefined} untill nothing done after few time the data will be taken only once after the data will be filled in js... now the soluation:--- const promise=createOrder(cart);//1 after the data will be filled then called the function attachement.. promise.then(function(orderId){ proceedTopayment(orderId); }); like we do call api fetch().then(res=>log(res).catch(err=>err); immutable not change callback can create call back scenerio as well as

create promise 3

  let cart = [ "shoes" , "pants" , "kurtas" ]; createOrder ( cart )     . then ( function ( res ) {         console . log ( res );         // promise chaining         return res ;     })     // .catch(err => {     //     console.log(err.message);     // })     . then ( function ( res ) {         return proceedToPayment ( res );     })     . then ( function ( paymentInfo ) {         console . log ( paymentInfo );     }). catch ( err => {         console . log ( err . message );     }). then ( function ( paymentInfo ) {         console . log ( 'this will run anyhow' );     })     ; // start api which is running to order creation:--- function createOrder ( cart ) {     const myPromise = new P...

creating promise 2

  let cart = [ "shoes" , "pants" , "kurtas" ]; createOrder ( cart )     . then ( function ( res ) {         console . log ( res );         // promise chaining         return res ;     })     . then ( function ( res ) {         return proceedToPayment ( res );     })     . then ( function ( paymentInfo ) {         console . log ( paymentInfo );     })     . catch ( err => {         console . log ( err . message );     }); // start api which is running to order creation:--- function createOrder ( cart ) {     const myPromise = new Promise ( function ( resolve , reject ) {         if ( ! validiteCart ( cart )) {             const err = new Error ( 'Cart is not valid' );           ...

creating own promise1

  let cart = [ "shoes" , "pants" , "kurtas" ]; const promise = createOrder ( cart ); console . log ( promise ); promise . then (( res ) => {     console . log ( res );     //promise channing     }) . catch ( err => {   console . log ( err ); })     //start api which is running to order creation:--- function createOrder ( cart ){     const mypromise = new   Promise ( function ( resolve , reject ){         if ( ! validiteCart ( cart )){             const err = new Error ( 'cart is not valid' );             reject ( err );         }         const orderId = '123' ;         if ( orderId ){             // resolve (orderId);             setTimeout (() => {                 con...

tanstack table

 https://tanstack.com/table/latest/docs/framework/react/examples/filters https://mockaroo.com/:random data generator https://codesandbox.io/p/devbox/github/tanstack/table/tree/main/examples/react/filters?file=%2Fsrc%2Fmain.tsx&from-embed= import React ,{ useState } from 'react' import Data from '../Data.json' ; import { Box } from '@chakra-ui/react' ; import { flexRender , getCoreRowModel , getPaginationRowModel , getSortedRowModel , useReactTable , getFilteredRowModel } from '@tanstack/react-table' ; const columns = [     {         accessorKey : "id" ,         header : "ID" ,         //cell:(props)=><p>{props.getValue()}</p>//this is used for formating...     },     {         accessorKey : "name" ,         header : "name" ,         //cell:(props)=><p>{props.getValue()}</p>    ...

React Formik

 https://formik.org/docs/tutorial

debouncing in react[search]

 https://www.youtube.com/watch?v=dtacfvLcoxY https://www.youtube.com/watch?v=AkHvKi2s9hw