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 Data with TanStack Query (Premium)

Manual loading flags, caching and refetching are a lot of boilerplate. TanStack Query handles all of it: you describe how to fetch, and it gives you cached data plus loading...

import { useQuery } from "@tanstack/react-query";

function fetchPatients() {
  return fetch("/api/patients").then((r) => {
    if (!r.ok) throw new Error("Request failed");
    return r.json();
  });
}

export function PatientList() {
  const { data, isLoading, isError, error } = useQuery({
    que...

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...