React Anti-Pattern: Stop Passing Setters Down the Components Tree (4 minute read)
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.
|
Conditional Props in React Using Type Discrimination (7 minute read)
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.
|
|
Oncall shift should be Tuesday to Tuesday (5 minute read)
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.
|
|
How to secure Liveblocks Rooms in Next.js (Sponsor)
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.
|
React Scan (GitHub Repo)
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.
|
|
Understanding the BM25 full text search algorithm (14 minute read)
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.
|
Go Turns 15 (6 minute read)
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.
|
|
Please just stop saying "just" (5 minute read)
The word "just," when used to describe a software engineering solution, minimizes the complexity of the task, discourages critical thinking and alternative solutions, and contributes to imposter syndrome.
|
|
Love TLDR? Tell your friends and get rewards!
|
Share your referral link below with friends to get free TLDR swag!
|
|
Track your referrals here.
|
Want to advertise in TLDR? π°
|
If your company is interested in reaching an audience of web developers and engineering decision makers, you may want to advertise with us.
If you have any comments or feedback, just respond to this email!
Thanks for reading,
Priyam Mohanty, Jenny Xu & Ceora Ford
|
|
|
|