Enjoy these free Code Nuggets?

Your support helps us create more high-quality content and unlocks exclusive premium nuggets via a personal activation link.

Support Our Work & Get Exclusive Access
🤖 New — AI Training

Learn to code with AI, not just about it.

Beyond free snippets, we run hands-on training in AI-assisted coding — teaching developers, teams and beginners how to build real software faster using modern AI tools. You bring the ideas; we show you how to ship them with an AI pair-programmer at your side.

  • ✔ Prompting & pairing with AI coding assistants to write, debug and refactor real code
  • ✔ Turning plain-English ideas into working apps, scripts and automations
  • ✔ Reviewing AI output safely — spotting bugs, security gaps and hallucinations
  • ✔ Live cohorts, team workshops and 1-on-1 mentoring — remote or on-site in Kenya
ai-pair-session.md

# You describe it…

"Build me a booking form that emails the client."

# …the AI drafts it…

▸ generating form + mailer…

â–¸ 24 lines written, 0 errors

# …and we teach you to lead it.

✱ You stay the engineer. AI is the tool.

React / TanStack nuggets

3 nuggets found

Clear filter

Fetching Server State with TanStack Query (React Query) v5

Mastering Server State Synchronization, Caching, and Optimistic Updates Managing server state manually with useEffect causes race conditions and stale UI data. TanStack Query (v5) provides battle-tested declarative caching and query...

import React from 'react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import axios from 'axios';

export const QuotesTable = () => {
  const queryClient = useQueryClient();
  const { data: quotes, isLoading } = useQuery({
    queryKey: ['quotes'],
    queryFn: asy...

Powerful, Headless Data Grids with TanStack Table (Premium)

TanStack Table is headless — it gives you sorting, filtering and pagination logic while you keep full control of the markup and styling. Define columns, hand it rows, and render.

import {
  useReactTable, getCoreRowModel, getSortedRowModel, flexRender,
} from "@tanstack/react-table";
import { useState } from "react";

const columns = [
  { accessorKey: "name", header: "Name" },
  { accessorKey: "role", header: "Role" },
  { accessorKey: "createdAt", header: "Joined" },
];

e...

Type-safe Routes and Loaders with TanStack Router (Premium)

TanStack Router gives you fully typed routes and data loaders that run before a component renders, so your screen already has its data on first paint — no flash of...

import { createRootRoute, createRoute, Outlet } from "@tanstack/react-router";

const rootRoute = createRootRoute({ component: () => <Outlet /> });

const patientRoute = createRoute({
  getParentRoute: () => rootRoute,
  path: "/patients/$patientId",
  // loader runs before the component mounts
  lo...