Advertisement · 728 × 90

Posts by Sathya

Preview
React Labs: View Transitions, Activity, and more – React The library for web and native user interfaces

Today we're sharing that View Transitions and Activity are ready to try in the experimental channel, along with docs and updates on other areas we're actively working on:

react.dev/blog/2025/04...

11 months ago 220 47 8 23
Preview
[Compiler Bug]: `===` is not a sufficient equality check · Issue #31359 · facebook/react What kind of issue is this? React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization) babel-plugin-react-compiler (build issue installing or using the Babel...

for perf reasons

github.com/facebook/rea...

1 year ago 7 0 0 0
Preview
Sunsetting Create React App – React The library for web and native user interfaces

Today, we’re deprecating Create React App for new apps, and encouraging existing apps to migrate to a framework.

We’re also providing docs for when a framework isn’t a good fit for your project, or you prefer to start by building a framework.

react.dev/blog/2025/02...

1 year ago 574 103 32 74
Preview
[compiler] Rewrite useContext callee by gsathya · Pull Request #30612 · facebook/react Stack from ghstack (oldest at bottom): [compiler] Add context callee import if required #30628 -> [compiler] Rewrite useContext callee #30612 If a value is specified for the LowerContextAccess...

Implemented, evaluated and deleted already

github.com/facebook/rea...

1 year ago 4 0 2 0

ugh so sorry to hear that :(

1 year ago 1 0 0 0
Preview
Ref Callbacks, React 19 and the Compiler Reflecting on useCallback, how the Compiler changed my thinking about it, and what React 19 has in store for Ref Callbacks...

Ref Callbacks got an upgrade with React 19, and the presence of the React Compiler has further changed my thinking about using useCallback for those in some situations.

tkdodo.eu/blog/ref-cal...

Thank you @gsathya.bsky.social for starting the discussion about this 🙇‍♂️

1 year ago 101 13 6 1
new project with React 19

new project with React 19

Let's go! 🚀

1 year ago 4 1 1 1

yeah _pure_ isn't correct, it's more about the captured context -- the compiler moves functions that don't capture any values created in render

1 year ago 2 0 1 0

cc @ricky.fm

1 year ago 3 0 0 0
Advertisement

add me!

1 year ago 1 0 1 0

don’t useEffect, but if you must, don’t call setState in it

1 year ago 209 29 16 5
Post image

I got to speak wearing a traditional Tamil veshti!

1 year ago 32 0 0 0

so bummed that they've stopped archiving now :(

1 year ago 1 0 0 0

Don't use memoization for correctness, use it only for perf!

1 year ago 15 1 1 0

it's too early to share anything concrete as everything could change, but we're thinking deeply about effects!

1 year ago 7 0 2 0

no you should write it! I always learn something new from your posts

1 year ago 1 0 1 0
Advertisement

i agree! we're already working on something to make this easier ;)

1 year ago 3 0 1 0

yes that'd be awesome! :)

1 year ago 1 0 1 0

Yes exactly!

1 year ago 4 0 1 0

in the long term, we want to move away from manual memoization in react and would like to remove these APIs

1 year ago 1 0 1 0

this is why the compiler currently bails out on compiling a component if it's newly compiled memoization is different from the existing manual memoization

so we want folks to just use memo for optimization and then just remove all manual memo after adding the compiler

1 year ago 2 0 1 0

best case you delete all manual memo and it just works with the compiler because the compiler memoizes everything in the same way

but the compiler could've memoized this callback differently because of heuristics, so it may not be safe to remove this particular useCallback

1 year ago 2 0 1 0

Imagine you're adopting the compiler and the compiler works great on your app and you ship it. Now you want to delete the useMemo/useCallback from your code to improve dx. How do you know which ones are safe to remove?

1 year ago 11 0 1 2
Advertisement

you're right that the callback won't be thrown away but using memoization for correctness can cause downstream issues

1 year ago 3 0 1 0

I'd store the id in a ref and check that manually and not depend on useCallback:

```
const idRef = useRef(null);
const scroller = (node) => {
if (idRef.current === null || idRef.current !== id) {
node?.scrollIntoView({ behavior: "smooth" });
idRef.current = id;
}
};
```

1 year ago 9 1 1 2

Also I just realized a potential bug in the compiler after reading your post! The compiler will automatically move pure functions outside the component, which can break callback ref identity check

1 year ago 10 0 1 1

Right, I was referring to the useCallback example (I meant memoization in general, not useMemo)

1 year ago 2 0 2 0
Preview
Avoiding useEffect with callback refs Interacting with DOM nodes doesn't necessarily need useEffect

📚 Had to post this a lot on the other platform lately and apparently, it blows people's mind that this is possible. I wrote it over 2 years ago, and callback refs will only get better in v19 because they will get cleanup functions. Have a read:

tkdodo.eu/blog/avoidin...

1 year ago 212 25 13 2

Nice post! One minor nit would be to not use memo for correctness -- you can use a ref to store a boolean and check this boolean before doing the focus instead

1 year ago 4 0 1 0

This one is special because it's happening at home in Chennai! :)

1 year ago 10 1 0 0