Skip to content

Instantly share code, notes, and snippets.

View whoisYeshua's full-sized avatar
🏠
Working from home

whoisYeshua

🏠
Working from home
View GitHub Profile
@whoisYeshua
whoisYeshua / Reconciliation.tsx
Created April 13, 2024 09:59
React Reconciliation
import { useState, useMemo, useReducer, memo } from "react";
const MyButton = memo(() => {
const value = useMemo(() => Math.random(), []);
return <button>MyButton {value}</button>;
});
export default function MyApp() {
const [flag, setFlag] = useState(false);
@whoisYeshua
whoisYeshua / Troubles-not-ok.tsx
Created April 11, 2024 08:37
Troubles-not-ok
import React, { memo, useEffect, useMemo, useState } from "react";
import { Divider, Header, List, Image, Grid } from "semantic-ui-react";
type TMovie = {
id: string;
previewLink: string;
name: string;
year: string;
description: string;
rate: string;
@whoisYeshua
whoisYeshua / importmap.json
Created March 23, 2024 04:53
Dynamic importmap content loading from JSON file
{
"imports": {
"react": "https://esm.sh/stable/react@18.2.0/es2022/react.mjs",
"react-dom/client": "https://esm.sh/stable/react-dom@18.2.0/es2022/client.js"
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Number(str) vs +str</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@whoisYeshua
whoisYeshua / index.html
Created January 12, 2022 10:23
[...str] vs Array.from(str) (http://jsbench.github.io/#559a59d681819d0d41351eb1fa605a5c) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>[...str] vs Array.from(str)</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@whoisYeshua
whoisYeshua / index.html
Created January 10, 2022 19:31
Filter with has vs Filter with includes (http://jsbench.github.io/#cb72bdec400ae1f1f6036ceb65bcc7cb) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Filter with has vs Filter with includes</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>