TLDR Web Dev

TLDR WEB DEV 2024-11-20

6 sections18 entrieslinks blockcomplete parse

Parse notes

  • Subscription/account footer truncated before parsefooter_truncated

01GENERAL

02ARTICLES & TUTORIALS

REACT ANTI-PATTERN: STOP PASSING SETTERS DOWN THE COMPONENTS TREE

Passing `useState` setter functions as props to child components is a React anti-pattern. This creates an abstraction leak, tightly coupling the child to the parent's internal state management and making the code fragile and less reusable. The solution is to instead pass a callback function that encapsulates the state change, allowing the child to update the parent's state without knowing the specific implementation details.

matanbobi.dev4 min read

CONDITIONAL PROPS IN REACT USING TYPE DISCRIMINATION

TypeScript's type discrimination can be used to manage conditional props in React components, making sure props are type-safe and mutually exclusive when required. This article shows practical examples, like defining components that accept either one prop or another but not both.

elanmed.dev7 min read

OFFSET CONSIDERED HARMFUL OR: THE SURPRISING COMPLEXITY OF PAGINATION IN SQL

SQL pagination is complex and using the offset keyword can make it worse. `offset` can lead to duplicate results and degrade performance, especially with large datasets, due to its need to process and skip data. A better alternative is to use predicate-based pagination with a `where` condition.

cedardb.com11 min read

03OPINIONS & ADVICE

ONCALL SHIFT SHOULD BE TUESDAY TO TUESDAY

A Tuesday-to-Tuesday on-call rotation is better than Monday-to-Monday because it accommodates weekend issue resolution and holiday scheduling, allowing for a more thorough follow-up on problems. It's a simple, low-cost improvement to overall team efficiency.

arthur-johnston.com5 min read

HOW I SHIP PROJECTS AT BIG TECH COMPANIES

Engineers should prioritize impact over optics and focus on delivering meaningful results that improve metrics and benefit users. Trust and recognition are gained through impactful work and should not be the primary goal.

developing.dev3 min read

04LAUNCHES & TOOLS

Sponsored

HOW TO SECURE LIVEBLOCKS ROOMS IN NEXT.JS

Learn how to secure real-time collaborative apps by integrating Liveblocks with Clerk in a Next.js setup. This guide addresses unauthorized access risks by ensuring only authenticated users can access Liveblocks rooms, enhancing security in apps like team-based task managers. Perfect for developers prioritizing data protection in collaborative environments.

go.clerk.comSponsor

REACT SCAN

React Scan is a tool that automatically detects and highlights performance issues in React applications. Unlike other tools, it requires minimal code changes and provides clear visual cues to pinpoint problematic components.

github.comGitHub repository

PGLITE-FUSION

Pglite-fusion lets users embed SQLite databases into their PostgreSQL tables.

github.comGitHub repository

05MISCELLANEOUS

UNDERSTANDING THE BM25 FULL TEXT SEARCH ALGORITHM

The BM25 algorithm is a full-text search algorithm widely used in systems like Lucene/Elasticsearch and SQLite. This post goes over the algorithm's mathematical components - inverse document frequency (IDF), term frequency, and document length normalization - showing how they contribute to a relevance score.

emschwartz.me14 min read

GO TURNS 15

Go recently celebrated its 15th anniversary as an open-source project. Its user base has more than tripled in the last five years. Recent Go releases (1.22 and 1.23) were focused on improving for loops, iterators, and generics, along with improvements to the standard library, including the HTTP router and execution traces.

go.dev6 min read