Skip to content

Instantly share code, notes, and snippets.

View djmin43's full-sized avatar
🥗

Dongjoon Min djmin43

🥗
View GitHub Profile
import "../styles/globals.css";
import type { AppProps } from "next/app";
import Script from "next/script";
function MyApp({ Component, pageProps }: AppProps) {
return (
<>
<Script
src="//dapi.kakao.com/v2/maps/sdk.js?appkey=6887e18eea343d9ecb3cc5e964acd13b&libraries=services,clusterer&autoload=false"
strategy="beforeInteractive"
import "../styles/globals.css";
import type { AppProps } from "next/app";
import Script from "next/script";
function MyApp({ Component, pageProps }: AppProps) {
return (
<>
<Script
src="//dapi.kakao.com/v2/maps/sdk.js?appkey=6887e18eea343d9ecb3cc5e964acd13b&libraries=services,clusterer&autoload=false"
strategy="beforeInteractive"
// CASE #1: no abstraction
const displayNameOnly = 'Jay Min'
const nameWithAge = 'Jay Min, 33'
const nameAndFavouriteMovie = 'Jay Min, favourite movie: Baby Driver'
const nameAndFavouriteBand = 'Jay Min, favourite band: Black Sabbath'
// SORT BY DATE (TOGGLE)
const sortByDate = () => {
if (new Date(inventory[0].expiration_date).valueOf() < new Date(inventory[inventory.length -1 ].expiration_date).valueOf()) {
const sortedInventory = inventory.slice(0).sort((a: Inventory, b:Inventory) => {return new Date(b.expiration_date).valueOf() - new Date(a.expiration_date).valueOf()})
setInventory(sortedInventory)
} else {
const sortedInventory = inventory.slice(0).sort((a: Inventory, b:Inventory) => {return new Date(a.expiration_date).valueOf() - new Date(b.expiration_date).valueOf()})
setInventory(sortedInventory)
}
}