Newslurp

<< Stories

React anti-patterns πŸ§‘β€πŸ’»οΈ, React performance scanner ⚑️, better on-call shifts πŸ“ž

TLDR Web Dev <dan@tldrnewsletter.com>

November 20, 12:11 pm

TLDR WebDev
Passing `useState` setter functions as props to child components is a React anti-pattern. This creates an abstraction leak β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ  β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ β€Œ 

TLDR

Together With Atlassian

 TLDR Web Dev 2024-11-20

Zero meetings? It's possible - and easier than you think (Sponsor)

β€œI love having a calendar full of meetings” β€” said no developer, ever. But is it really possible to deliver a project without any meetings at all?

The answer is yes. Join Andrew Boyagi from Atlassian as he walks through the "meeting-less project" that went viral on LinkedIn, and see how you can do it too.

You'll leave with clear guidance on how to structure and communicate throughout a zero-meetings project, while managing async work with tools like Jira and Loom. You'll also get hear some interesting perspectives on introducing flexible ways of working to any team.

> Register for the webinar

> Get Atlassian Loom (free)

πŸ§‘β€πŸ’»

Articles & Tutorials

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.
Offset Considered Harmful or: The Surprising Complexity of Pagination in SQL (11 minute read)

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

Opinions & Advice

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 I Ship Projects at Big Tech Companies (3 minute read)

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.
πŸš€

Launches & Tools

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.
Pglite-fusion (GitHub Repo)

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

Miscellaneous

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.
AWS Lambda turns ten – looking back and looking ahead (7 minute read)

AWS Lambda launched in 2014 and quickly gained traction. Today, it has over 1.5 million users and tens of trillions of function invocations monthly.
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.
⚑

Quick Links

Data Engineer Handbook (GitHub Repo)

A collection of data engineering resources, including projects, interview guides, roadmaps, books, and more.
Dynamically Generating PWA App Icons in the Next.js App Router (7 minute read)

This article goes over how to dynamically generate different Progressive Web App (PWA) icons for various environments (development, staging, and production) in a Next.js app, with code examples.
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.
Ask HN: How do you communicate in a remote startup? (Hacker News Thread)

Tips for improving remote startup communication include keeping discussions public on platforms like Slack, recording and summarizing meetings, sharing solutions openly, maintaining clear documentation, and avoiding excessive DMs.

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


If you don't want to receive future editions of TLDR Web Dev, please unsubscribe from TLDR Web Dev or manage all of your TLDR newsletter subscriptions.