Skip to content

Instantly share code, notes, and snippets.

View adamkleingit's full-sized avatar

Adam Klein adamkleingit

View GitHub Profile
@adamkleingit
adamkleingit / CompsUsingLocalization.js
Created July 9, 2019 10:44
Using ReusableLoclization
import {useCurrentLocale, LocaleSwitcher} from 'reusable-locale';
const Comp1 = () => {
const currentLocale = useCurrentLocale(); // Using a global store from external lib
}
const Comp2 = () => {
return <LocaleSwitcher/>; // External components using the same global store
}
@adamkleingit
adamkleingit / virtualScroll.js
Last active October 19, 2023 07:47
Vanilla Virtual Scroll Pseudo Code
const VirtualScroll = ({
renderItem,
itemCount,
viewportHeight,
rowHeight,
nodePadding,
}) => {
const totalContentHeight = itemCount * rowHeight;
let startNode = Math.floor(scrollTop / rowHeight) - nodePadding;