Components Are Just Sparkling Hooks

Components Are Just Sparkling Hooks

Here’s a question you might encounter while interviewing for React developer roles:

“What is the difference between a component and a hook?”

The answer that the interviewer is likely looking for is along the lines of “A component is a building block for the UI, and hooks are utility functions provided by React to manage state and side-effects šŸ˜“”.

It’s a satisfactory answer if your goal is to find employment. But if you want to make an impression, the more daring answer is: “There is no difference šŸ”„”.

Read more ā†’

Learn Suspense by Building a Suspense-Enabled Library

Learn Suspense by Building a Suspense-Enabled Library
Suspense has been a feature in React since v16.6.0. Despite this, I havenā€™t seen much of it in action beyond limited applications of ā€œsuspense-enabled librariesā€. The React team seems to think Suspense is so incomplete that the entire API remains undocumented. I think that purposefully hiding APIs in documentation is silly, but fine! Iā€™ll play their game! Letā€™s build a Suspense-enabled library, and use it. We will peel back the curtain of Suspense along the way.
Read more ā†’

Understanding React Concurrency

Understanding React Concurrency
React v18.0 has broken ground by introducing a long-awaited feature: Concurrency! Unfortunately, despite a deluge of resources explaining how to use it, explanations of how it works are sparse. As it is a low-level feature, itā€™s not critical to understand Reactā€™s idea of concurrency, but it doesnā€™t hurt!
Read more ā†’

Effective Higher-Order Components

Effective Higher-Order Components
Before the introduction of contexts and hooks in React v16.8, Higher-Order Components (or HOCs for short) were a common sight. Today, it is an under-used pattern. While the concept presents infinite possibilities, practical applications should be limited to transparently adding wrappers or logic.
Read more ā†’