This Week In React #176: useActionState, React Compiler, Million Lint, TanStack, Generative UI, Vinxi, Remix i18n, Next.js security, Typesafe Router, Shopify RN perf, RCTRootViewFactory, iOS Live Activities, Uni Stack, TypeScript, Parcel…

Seb @ ThisWeekInReact.com
8 min readMar 9, 2024

--

Hi everyone!

This week is difficult to sum up, there’s a lot of interesting news and I don’t know which to highlight.

We notably have a sneak peek of a new React core hook replacing the confusing useFormState, that even React Native devs will now be able to use now!

💡 Check this newsletter on Twitter — visual format 🎨

To support me:

💡Subscribe to This Week In React

If you are not signed-up, you are missing out

William CandillonReact-Native animations expert — Youtuber

⚛️ React

React Core PR — New useActionState hook

It turns out the useFormState hook was confusing, and not even meant to be solely used in forms. The React team is addressing this by introducing a new React core hook to replace it:

  • Renames useFormState to useActionState
  • Adds a pending state to the returned tuple
  • Moves the hook to the react package

Moving it from react-dom to react also means that now, other renderers such as React Native can use it too. There are other benefits to look at, such as a “partial progressive enhancement” feature, but also new caveats documented in the PR.

💡Subscribe to This Week In React

I’m constantly finding interesting things to learn in there.

Dominik DorfmeisterWeb Developer — React-Query maintainer

📱 React-Native

This section is now co-authored with Benedikt. Feel free to send us your comments by email or on Twitter!

Improving Shopify App’s Performance

Shopify has been a proponent of React Native for a long time. But they did notice their app performance go down since they migrated to React Native. Instead of blaming the tech stack, they got to work and started optimizing for performance. The results speak for themselves: App launch is 44 % faster and screen load times were reduced by 59 %. Here’s a quick summary of some of the measures they took (hint: FlashList plays a big role in some of these). For details, read their great summary post:

  • Initially, only render what’s visible on the screen (especially true for the home screen)
  • Build all screens as lists (based on FlashList)
  • Use inlineRequires
  • Batch state changes
  • Optimize caching

Very interesting insights and impressive results. I hope the Shopify team keeps sharing these details and maybe we’ll even see some of the things they mentioned they built during this process ending up as Open Source?

🔀 Other

🤭 Fun

See ya! 👋

💡Subscribe to This Week In React

--

--

Seb @ ThisWeekInReact.com

Join 17947 readers - subscribe to This Week In React for one email per week