2025-07-10
3293
Peter Aideloje
205750
110
Jul 10, 2025 â‹… 11 min read

React & TypeScript: 10 patterns for writing better code

Peter Aideloje I'm a passionate developer and technical writer whose interest aligns with full-stack software engineering, specifically Java, Csharp, and other frontend stacks like HTML5, CSS3, and JavaScript.

Recent posts:

Query strings are underrated: Using the URL as your app’s state container

Query strings are often overlooked as a way to manage app state, but they can make your React apps more shareable, persistent, and simple. This guide walks through the tools, trade-offs, and best practices for using query strings effectively.

Amazing Enyichi Agu
Sep 29, 2025 â‹… 3 min read
yes, you should upgrade to TypeScript 5.9 — here's why

Yes, you should upgrade to TypeScript 5.9 — here’s why

Explore the key features of TypeScript 5.9, including the redesigned tsc –init command, the new import defer syntax, expandable hovers, and significant performance improvements.

Chizaram Ken
Sep 29, 2025 â‹… 6 min read

Is Better Auth the key to solving authentication headaches?

Better Auth is an open-source, TypeScript-first auth library with adapters, schema generation, and a plugin system. Here’s how it works and how it stacks up to Clerk, NextAuth, and Auth0.

David Omotayo
Sep 26, 2025 â‹… 10 min read
What using a screen reader taught me about real web accessibility

What using a screen reader taught me about real web accessibility

Read one developer’s detailed account of using a screen reader to learn more about a11y and build more accessible websites.

Sebastian Weber
Sep 25, 2025 â‹… 29 min read
View all posts

2 Replies to "React & TypeScript: 10 patterns for writing better code"

  1. I would like to submit a code review for the Record utility snippet! It should read:

    type Role = “admin” | “employee” | “viewer”;

    type Permissions = Record;

    const permissions: Permissions = {
    admin: [“read”, “write”, “delete”],
    employee: [“read”, “write”],
    viewer: [“read”],
    };

    1) The Role type name defined and the name used in the Record utility are inconsistent.

    2) The colons are missing in the key: value pairs of the object literal.

    It’s tough to catch these things without the error highlighting that IDEs provide. Great article!

  2. Thank you for catching that and for taking the time to share your feedback!

    You’re absolutely right on both points:
    1. The Role type named defined in the Record utility should be consistent (Roles or Role) — and in the case of using ‘Role’, the correct syntax would be:

    type Permissions = Record;
    2. Also, the object literal should include colons in the key-value pairs, like so:

    const permissions: Permissions = {
    admin: [“read”, “write”, “delete”],
    employee: [“read”, “write”],
    viewer: [“read”],
    };

    Appreciate you pointing it out, great eye! I’m glad you enjoyed the piece!

Leave a Reply