Pierre-Henry™

@ph7
2 Followers
0 Following
316 Posts
Super passionate senior software engineer who loves learning, researching, and trying new things each day!
I'm also a real Roquefort 🧀, dark chocolate 🍫, and ristretto lover! ☕️
GitHubhttps://github.com/pH-7
YouTubehttps://youtube.com/@ph7programming
pH7https://ph7.me
Convert values to booleans in JSX conditionals, and let your pipeline enforce it automatically.

To prevent the React && rendering bugs before they ship, add a lint rule and let CI enforce it.
Such as below ⬇️

// eslint.config.js
rules: {
'react/jsx-no-leaked-render': ['error', {
validStrategies: ['coerce', 'ternary']
}]
}

Push → Lint → Block unsafe JSX → Merge.

TL;DR: Never rely on raw values like .length in JSX conditionals. Always convert them to a boolean first.

0 is falsy in JavaScript, but && returns the value itself.
React can render numbers, so 0 appears in the UI.

Safer patterns:

!!items.length && <List />

or

items.length > 0 && <List />

Tiny detail. Real UI bugs!

A small React behaviour that still catches engineers off guard.

If you write:

items.length && <List />

React may render 0 instead of nothing.

↓↓ Why? ↓↓

Start small.
One feature 🟰 One flag

Certainly, you'll never ship without them again! 🚀

■ WorkOS - manages feature flags and lets you enable features for specific users only. Great for rolling out to testers first, then gradually to everyone.

■ FeatBit - open source, self-hosted option if you want full control. Worth checking out: https://github.com/featbit/featbit

GitHub - featbit/featbit: Enterprise-grade feature flag platform that you can self-host. Get started - free.

Enterprise-grade feature flag platform that you can self-host. Get started - free. - featbit/featbit

GitHub
↓↓ Now, the handy tools worth knowing are ↓↓
The idea is simple! Every new feature sits behind a toggle. If something breaks, you turn it off. No hotfix, no rollback panic, no 3am incident.
The default value of a feature flag should always be off.

Feature flags are one of those things that separate teams that ship confidently from those that cross their fingers on every release... and freeze deployments after 4 PM and on Fridays.

Here’s how we avoid that ↓ ↓ ↓