This file contains 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 months = ["Jan", "Mar", "Mar", "April"]; | |
months.splice(1, 2, "Feb", "Feb2"); | |
console.log(months) | |
//output: [Jan,Feb,Feb2,April] |
This file contains 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 months = ["Jan", "Mar", "Mar", "April"]; | |
months.splice(1, 1, "Feb"); | |
console.log(months) | |
//output: [Jan,Feb,Mar,April] |
This file contains 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 months = ["Jan", "Mar", "Mar", "April"]; | |
let febs = ["Feb", "Feb2", "Feb4"]; | |
let returnedValue = months.splice(1, 3, ...febs); | |
console.log(returnedValue) | |
//output: ["Mar","Mar","April"] |
This file contains 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 months = ["Jan", "Mar", "Mar", "April"]; | |
months.splice(1, 3, "Feb", "Feb2", "Feb3"); | |
//output: [Jan,Feb,Feb2,Feb3] |
This file contains 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 } from "react"; | |
import { useDropzone } from "@tofusoup429/dropzone"; | |
const SimpleDropzone = () => { | |
let {fileName, dndStatus, fileContent, fileSize, initializeStates} = useDropzone("DNDTargetElement"); | |
useEffect(()=>{ | |
if(dndStatus === 'drop'){ | |
console.log(fileContent); | |
console.log(fileSize); // fileSize may be useful when you want to put restriction on the max size of acceptable file | |
//do whatever you want with the fileContent | |
initializeStates() |
This file contains 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, useEffect} from 'react'; | |
type DragAndDropStatus = "none"|"dragover"|"drop"|'dbclick'; | |
interface Returns { | |
fileName:string, | |
dndStatus:DragAndDropStatus, | |
fileContent:ArrayBuffer|string|null, | |
fileSize:number, | |
initializeStates:()=>void; |
This file contains 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 url:string = "https://...some-server-url.com"; | |
const params:OrganizationUpdate = { | |
address:"...new address" | |
} | |
const updateRequest = await axios.post(url, params) |
This file contains 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 OrganizationUpdate{ | |
address:"...new address" | |
} |
This file contains 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 url:string = "https://...some-server-url.com"; | |
const params:Pick<Organization, "address"|"nationality"> = { | |
address:"...new address", | |
nationality:"China" | |
} | |
const updateRequest = await axios.post(url, params) |
This file contains 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 url:string = "https://...some-server-url.com"; | |
const params:Partial<Organization> = { | |
address:"...new address" | |
} | |
const updateRequest = await axios.post(url, params) |