Sathya's Avatar

Sathya

@gsathya.bsky.social

react at meta formerly: v8/chrome at google 🌐 recompiled.dev

810 Followers  |  74 Following  |  27 Posts  |  Joined: 01.11.2024  |  2.2808

Latest posts by gsathya.bsky.social on Bluesky

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

23.04.2025 15:45 β€” πŸ‘ 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...

10.04.2025 09:46 β€” πŸ‘ 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...

14.02.2025 18:44 β€” πŸ‘ 577    πŸ” 105    πŸ’¬ 33    πŸ“Œ 75
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...

10.01.2025 04:35 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

ugh so sorry to hear that :(

09.12.2024 03:43 β€” πŸ‘ 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 πŸ™‡β€β™‚οΈ

08.12.2024 18:20 β€” πŸ‘ 101    πŸ” 13    πŸ’¬ 6    πŸ“Œ 1
new project with React 19

new project with React 19

Let's go! πŸš€

07.12.2024 19:09 β€” πŸ‘ 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

07.12.2024 16:03 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

cc @ricky.fm

07.12.2024 05:15 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

add me!

27.11.2024 02:22 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

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

23.11.2024 16:20 β€” πŸ‘ 210    πŸ” 29    πŸ’¬ 17    πŸ“Œ 5
Post image

I got to speak wearing a traditional Tamil veshti!

23.11.2024 12:22 β€” πŸ‘ 32    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

so bummed that they've stopped archiving now :(

22.11.2024 14:22 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

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

22.11.2024 14:08 β€” πŸ‘ 15    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0

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

22.11.2024 14:07 β€” πŸ‘ 7    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

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

22.11.2024 14:07 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

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

22.11.2024 13:04 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

yes that'd be awesome! :)

22.11.2024 12:58 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Yes exactly!

22.11.2024 12:46 β€” πŸ‘ 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

22.11.2024 12:46 β€” πŸ‘ 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

22.11.2024 12:46 β€” πŸ‘ 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

22.11.2024 12:46 β€” πŸ‘ 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?

22.11.2024 12:46 β€” πŸ‘ 11    πŸ” 0    πŸ’¬ 1    πŸ“Œ 2

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

22.11.2024 12:46 β€” πŸ‘ 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;
}
};
```

22.11.2024 12:46 β€” πŸ‘ 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

22.11.2024 10:32 β€” πŸ‘ 10    πŸ” 0    πŸ’¬ 1    πŸ“Œ 1

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

22.11.2024 10:27 β€” πŸ‘ 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...

22.11.2024 08:05 β€” πŸ‘ 213    πŸ” 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

22.11.2024 09:51 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

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

22.11.2024 09:27 β€” πŸ‘ 10    πŸ” 1    πŸ’¬ 0    πŸ“Œ 0

@gsathya is following 20 prominent accounts