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:

Why third-party integrations break in React 19 — And how to future-proof them

React 19 breaks old third-party integrations. Learn why concurrent rendering exposes brittle SDKs and how to rebuild them with resilient modern patterns.

Ikeh Akinyemi
Oct 20, 2025 ⋅ 4 min read
React useEffectEvent: Goodbye to stale closure headaches

React useEffectEvent: Goodbye to stale closure headaches

Discover why the useEffectEvent Hook is important, how to use it effectively, and how it compares to useRef.

David Omotayo
Oct 17, 2025 ⋅ 5 min read
I Tried Shadcn CLI 3.0 — Here’s What I Learned

I tried Shadcn CLI 3.0 — here’s what I learned

Shadcn CLI 3.0 takes component management to a new level. With namespaced registries, private access, and AI-powered discovery, it’s now faster and smarter to build React UIs.

Emmanuel John
Oct 17, 2025 ⋅ 6 min read

Why is Zod so slow?

Zod’s flexibility comes at a cost. This article breaks down why Zod is slower than AOT-compiled validators like Typia, and how to fix it with a build-time optimization that brings production-grade performance.

Ikeh Akinyemi
Oct 16, 2025 ⋅ 5 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

Would you be interested in joining LogRocket's developer community?

Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.

Sign up now