This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getParams = () => { | |
const search = window.location.search; | |
const params = new URLSearchParams(search); | |
const TokenParam: any = params.get('token'); | |
console.log(TokenParam); | |
} | |
useEffect(() => { | |
getParams() | |
}, []) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof window !== 'undefined') { | |
console.log('You are on the browser'); | |
// ✅ Can use window here | |
console.log(window.innerWidth); | |
window.addEventListener('mousemove', () => { | |
console.log('Mouse moved'); | |
}); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface PersonProps { | |
name: string; | |
age: number; | |
hobbies: Array<string>; | |
isCool: boolean; | |
} | |
// Boolean type | |
const [isCool] = React.useState<boolean>(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk') | |
const lambda = new AWS.Lambda() | |
const sleep = (milliseconds) => { | |
return new Promise(resolve => setTimeout(resolve, milliseconds)) | |
} | |
const recursionLimit = 5 | |
exports.handler = async(event) => { | |
await sleep(2000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk') | |
const lambda = new AWS.Lambda() | |
const sleep = (milliseconds) => { | |
return new Promise(resolve => setTimeout(resolve, milliseconds)) | |
} | |
const recursionLimit = 5 | |
exports.handler = async(event) => { | |
await sleep(2000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import ComponantA from "./ComponantA"; | |
import ComponantB from "./ComponantB"; | |
import ComponantC from "./ComponantC"; | |
function ChangeComponantSelect(){ | |
const [selected,setSelected]=useState('First Componant') | |
const handleChange=(e)=>{ | |
console.log(e.target.value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react' | |
import { Dialog } from '@headlessui/react' | |
import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline' | |
const navigation = [ | |
{ name: 'Product', href: '#' }, | |
{ name: 'Features', href: '#' }, | |
{ name: 'Marketplace', href: '#' }, | |
{ name: 'Company', href: '#' }, | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// api.ts | |
import axios, { AxiosResponse } from 'axios'; | |
import apiConfig from './apiConfig'; | |
// Define interfaces for request data types | |
interface LoginData { | |
email: string; | |
password: string; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react"; | |
const ThirtySecCounter = () => { | |
const [timeLeft, setTimeLeft] = useState(30); | |
useEffect(() => { | |
if (!timeLeft) return; | |
const intervalId = setInterval(() => { | |
setTimeLeft((prevTimeLeft) => prevTimeLeft - 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Shaking Particles</title> | |
<style> | |
.shape { | |
position: absolute; | |
width: 50px; | |
height: 50px; | |
transform: scale(0.8); |