Bytes.dev - Bytes: Why Web Components Lost

Bytes banner (Turn on images 😘)

This week, we’ve got React hook turtles all the way down, Jörmungandr trying to take down JavaScript, and a surefire way to get on Linus Torvalds' good side.

Welcome to #99.


Turtles on Turtles

React hooks are causing problems which can only be solved by another React hook which is causing problems which can only be solved by another React hook which is causing problems which can only be solved by another React hook.

React Hooks is turtles all the way down

Using React hooks is kinda like cutting your own hair. Seems easy enough, but in reality you’re a screw up away from a buzzcut and an unhappy spouse (couldn’t be me…). For years now React developers have struggled with the hooks API, specifically with useEffect. Up until now, to avoid issues with useEffect, you’ve probably had to write code you aren’t proud of.

Fortunately, the React core team just posted a RFC (request for comments) for a new hook to solve your problems… or confuse you even more… or both (jury’s still out).

We don’t have space to go into all the details, (that’s what the RFC is for), but here’s the tl;dr. The new hook is called useEvent. It provides a “stable identity” function, that always runs with the latest props/state without needing the dependency array. It’s like useCallback but also not like useCallback. So where does useEffect come in? Well, it’s like useEffect but also not like useEffect.

If that’s confusing, here’s a great tweet that should help.

The React core team is still collecting feedback on the API, so there’s a small chance the name or something else important will change. But we’re confident it will turn out great (given that design by committee typically produces great results 🙂).

The bottom line: Some hooks are confusing. And so more, less confusing hooks will help with the confusing hooks. Don’t worry if you’re confused - you’re not alone.


Skeleton admiring some silk

"You set this up in 5 minutes? Incredible." [sponsored]

FusionAuth made my job fun again

I got into this industry for one reason – my burning passion for building complex authentication solutions.

Ok, that’s a lie.

Call me old fashioned, but I’m just a little more interested in building features that users *actually* care about – instead of worrying about crap like SSO, MFA, user management, and all the security headaches that come along for the ride.

That’s why we’re huge fans of FusionAuth.

They handle all of the messy auth and security stuff for you, and make it super easy to integrate with your app in 5 minutes or less (no matter how weird your tech stack is).

They’re also way more flexible than most other auth tools – you can deploy anywhere, you can self-host, and you can easily customize whatever you want with their straightforward APIs and webhooks.

Check it out – and never worry about hand rolling auth again.


Samuel L. Jackson holding a snake.. on a plane

I've had it with these mother-fricking snakes in my mother-fricking HTML

Python in the browser?

We knew this day would come eventually: Python is coming for the web. This is not a drill.

Wtf? The Anaconda team just announced PyScript – a brand new framework that lets you run Python in the browser and build web apps using Python and “special HTML tags”, which we all know and love mostly ignore as web components.

Why tho? Because just like Jörmungandr, the giant snake child of Loki in Norse Mythology that wraps itself around the entire world, Python is coming for us all.

In a more literal (and less apocalyptic) sense, the PyScript team says they created it to “give users a first-class programming language that is less weird, more expressive, and easier to learn than Javascript.” Ouch 😔

Besides the subtweeting, here’s what else is going on inside PyScript:

  • A clean-and-simple API and HTML elements with custom components that are “opinionated and predictable.”

  • A tech stack built on WebAssembly, Emscripten (no we didn’t make that word up), and Pyodide that tries to “strip away most of the complexity of the client/server modern web” by enabling drop-in content, external file hosting, and app hosting that doesn’t rely on server-side configuration.

  • A simple way to run popular Python packages and the scientific stack in the browser.

  • Bi-directional communication between Python and JavaScript objects and namespaces, so that everyone can play nice together.

The bottom line: You can keep your fancy new “simplified web platform.” I’ll be over here executing arbitrary code from NPM while I argue on Twitter about a UI library being too low level.


Jobs

Yeti Labs is looking for Frontend (React + Typescript) developers

Yeti Labs is a human-centered frontend studio designing and building web apps for DeFi protocols. We love UI animations, innovative UXs, best practices, reusing our code, improving our workflow and learning new things. Come join our crew as we solve interesting challenges while having fun.

Loops is looking for founding full-stack Next.js engineers

Most email platforms are showing their age – heck, this email was sent via a platform that is 9 years old now! Loops is a modern and beautiful alternative for SaaS companies. Our stack is Next.js, Postgres, and Tailwind. We just wrapped YC and our seed funding raise led by Craft Ventures. Come join our core engineering team!


📝 QUIZ TIME – Sponsored by Retool

Retool’s brand new React component library makes it super easy to build any internal tool you can think of. We use Retool daily and we ❤️ it.

Given this HTML and CSS, what color is the background of the page?

<html>
  <head>
    <style>
      .cool {
        background: red;
      }

      body {
        margin:0;
        background: goldenrod !important;
      }

      @keyframes color {
        to {
          background: rebeccaPurple;
        }
      }

      body {
        animation: color 0s linear;
        animation-fill-mode: forwards;
      }
    </style>
  </head>
  <body class="cool">
    😎
  </body>
</html>

Cool Bits

  1. We made a totally non-controversial video about Why Web Components Lost. It’s similar to Severus Snape in The Deathly Hallows Part II, but - you know, without the redemption arc.

  2. Unlayer created this drag-and-drop email editor, page builder and popup builder that you can easily embed in your SaaS app. [sponsored]

  3. William Kennedy wrote a passionate defense of single page applications. It’s a little wordy, but it makes some great points.

  4. Jack Franklin (from the Chrome team) wrote an article called, Why I Don’t miss React – which reminds me of when I wrote a blog post called “Why I don’t miss my Ex.” It helped me heal too, Jack.

  5. Component Party lets you compare the syntax for similar components in React, Vue, Svelte, and Angular. Created by some guy named Rod.

  6. Ryan Dahl wrote an article about how JavaScript Containers could become a viable alternative to Linux Containers. Rumor has it that if you read it three times out loud, Linus Torvalds will personally show up to your house and verbally abuse you.

  7. Lerna lives! Last Monday, we wrote about how Lerna had declared that it’s no longer actively maintained, and then on Friday they announced that Nrwl would be taking over stewardship of the Lerna project. We don’t want to take 100% of the credit for saving it, but we also definitely do.

  8. Marc-André Giroux wrote about how GraphQL is not a trap – in response to a tweet thread that tried to make the opposite argument last week. Watching him dissect each tweet like a cross-examining trial lawyer felt like a watching the deposition scenes in The Social Network mixed with the Amber Heard–Johnny Depp trial, mixed with… GraphQL.


📝 QUIZ TIME Solution – Sponsored by Retool

<html>
  <head>
    <style>
      .cool {
        background: red;
      }

      body {
        margin:0;
        background: goldenrod !important;
      }

      @keyframes color {
        to {
          background: rebeccaPurple;
        }
      }

      body {
        animation: color 0s linear;
        animation-fill-mode: forwards;
      }
    </style>
  </head>
  <body class="cool">
    😎
  </body>
</html>

The !important overrides any other background colors on the element, but the animation keyframe overrides the background property, even with !important. That means the background color is actually rebeccaPurple.

The bug is using !important in the first place, and using the animation keyframes hack to override it. These are signs your CSS is difficult to maintain and will likely give you problems in the future. A better solution is using appropriate classes and specificity rules to override the background color without resorting to hacks.


Share Bytes

ui.dev banner
 

We work hard to make Bytes something you'd want to share with your developer friends. And to make it a little easier, we'll give you free stuff when you do.

20

Your bits

Your Referral Page

Your shareable link

https://bytes.dev?x=1697807915
 

Have a product you think our developers will love?
Advertise in Bytes

youtube icon youtube icon twitter icon instagram icon

50 W Broadway Ste 333 PMB 51647 Salt Lake City, Utah 84101

Unsubscribe from Bytes

Older messages

Bytes: making FTP cool again

Tuesday, May 3, 2022

“WTF is this?” First off, watch your language. The RWD Weekly newsletter (of which you were subscribed) has merged with Bytes (this newsletter) to bring you our educational, yet delightful dose of

Bytes: The Edge is just a spicy CDN

Tuesday, May 3, 2022

This week, we're experimenting with our runtime features, learning about The Edge™️, and (hopefully) avoiding accidental tax fraud. Welcome to #97. Some experiments pay off Node gets experimental

You Might Also Like

Daily Coding Problem: Problem #1707 [Medium]

Monday, March 3, 2025

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Facebook. In chess, the Elo rating system is used to calculate player strengths based on

Simplification Takes Courage & Perplexity introduces Comet

Monday, March 3, 2025

Elicit raises $22M Series A, Perplexity is working on an AI-powered browser, developing taste, and more in this week's issue of Creativerly. Creativerly Simplification Takes Courage &

Mapped | Which Countries Are Perceived as the Most Corrupt? 🌎

Monday, March 3, 2025

In this map, we visualize the Corruption Perceptions Index Score for countries around the world. View Online | Subscribe | Download Our App Presented by: Stay current on the latest money news that

The new tablet to beat

Monday, March 3, 2025

5 top MWC products; iPhone 16e hands-on📱; Solar-powered laptop -- ZDNET ZDNET Tech Today - US March 3, 2025 TCL Nxtpaper 11 tablet at CES The tablet that replaced my Kindle and iPad is finally getting

Import AI 402: Why NVIDIA beats AMD: vending machines vs superintelligence; harder BIG-Bench

Monday, March 3, 2025

What will machines name their first discoveries? ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

GCP Newsletter #440

Monday, March 3, 2025

Welcome to issue #440 March 3rd, 2025 News LLM Official Blog Vertex AI Evaluate gen AI models with Vertex AI evaluation service and LLM comparator - Vertex AI evaluation service and LLM Comparator are

Apple Should Swap Out Siri with ChatGPT

Monday, March 3, 2025

Not forever, but for now. Until a new, better Siri is actually ready to roll — which may be *years* away... Apple Should Swap Out Siri with ChatGPT Not forever, but for now. Until a new, better Siri is

⚡ THN Weekly Recap: Alerts on Zero-Day Exploits, AI Breaches, and Crypto Heists

Monday, March 3, 2025

Get exclusive insights on cyber attacks—including expert analysis on zero-day exploits, AI breaches, and crypto hacks—in our free newsletter. ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌

⚙️ AI price war

Monday, March 3, 2025

Plus: The reality of LLM 'research' ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Post from Syncfusion Blogs on 03/03/2025

Monday, March 3, 2025

New blogs from Syncfusion ® AI-Driven Natural Language Filtering in WPF DataGrid for Smarter Data Processing By Susmitha Sundar This blog explains how to add AI-driven natural language filtering in the