Skip to content

Instantly share code, notes, and snippets.

View layerok's full-sized avatar
🐺

Rudomanenko Volodymyr layerok

🐺
View GitHub Profile
@kyle-mccarthy
kyle-mccarthy / createSlice.ts
Last active June 27, 2024 01:23
namespaced slices in zustand
import type { GetState, PartialState, SetState, State } from "zustand";
const noop = (..._: unknown[]): void => {
/* noop */
};
export type Setter<T extends State> = (
s: Partial<T> | ((prev: T) => Partial<T>),
replace?: boolean
) => void;
@gpichot
gpichot / example.ts
Created September 25, 2024 16:28
Tanstack React Query pattern matching
export default function SessionsList() {
const sessionsQuery = useSessionsListQuery();
return (
<PageLayout title="My sessions">
{matchQueryStatus(sessionsQuery, {
Loading: (
<>
<Skeleton height={70} mt={6} />
<Skeleton height={70} mt={6} />