This Week In React #93: Server Components, Remix, Gatsby, React-Native-Web, Perf, Immutability, Stately, TypeScript, Deno...

Search for a command to run...

No comments yet. Be the first to comment.
Hi everyone! Krzysztof and Tomasz from Software Mansion here 👋 It's been a fairly calm week for the React ecosystem, but not for the React Native world. Meta has made an exciting announcement about the release of React Native 0.80, where they've dec...

Hi everyone! This week is relatively calm in the React ecosystem, but we still have various interesting blog posts and releases. Maybe we'll soon get some exciting news from React Summit that's about on Friday! On the React Native side, all the devs ...

Hi everyone! I thought I was on schedule for today's issue, until I realized that Dan Abramov wrote 4 RSC blog posts this week 😂. We also get great releases, including Storybook, LiveStore, Base UI, and the Lingo Compiler is a quite exciting innovat...

Hi everyone! Cyril and Matthieu from Theodo Apps here 👋. This week, the Remix team announced some big news. Microsoft has also made it easier to try out TypeScript Go rewriting. In the React Native world, there were a few minor but interesting relea...

Hi everyone! This week, we're delighted to finally have a preview of React Server Components support in React Router. I've also found some very interesting PRs on the React repo, and give you a glimpse of what could be coming soon! The React Native e...

Hi everyone!
Many great articles this week, in particular a very first pragmatic feedback on using Server Components at Shopify.
Newsletter is late this week because I'm trying to create a landing page for it: cf.thisweekinreact.com. I'm using a brand new stack (Remix, Tailwind, Cloudflare Pages), but I have some SSL issues and Cloudflare refuses to communicate with Revue API 😅.
I'm also using more emojis to "categorize" links. Please let me know if you find this useful 🤷♂️?
🙏 Support the newsletter:
Shopify: React Server Components best practices
Cathryn's feedback on the usage of Servers Components at Shopify, which she learned to use through their new Hydrogen framework. Without best practices, you might not leverage this new React feature properly and end-up with a bundle larger than it could be.
She advises to use Shared Components by default, instead of Client Components (what we use today). For interactivity, extract some Client Components with the finest granularity. Then try to convert the rest to Server Components if it's possible. The composition patterns (usage of children) that we sometimes use to optimize can also be used to interleave components of different types.
She offers a real decision tree, which she illustrates with 2 examples: newsletter signup and product FAQ.
A Shopify tutorial using server components has also been published: Rapid Development with Hydrogen: Building a Product Page
How to write performant React apps with Context
Nadia explains how you can optimize rendering on a complex React form using the React context. First, you have to separate into 2 contexts and hooks useFormData() and useFormAPI(). Do not forget to memorize properly the api object. We can eventually split the state into several smaller contexts.
These techniques may not scale as well as a real state manager, but are still useful to know in case you can't use one.
The "best" way to manage icons in React.js
There are many ways to use icons in React, each with different tradeoffs.
.svg files cannot be styled in CSS. React components that render SVG (also applies to SVGR) are convenient, but they inline the SVG markup in the HTML output and makes the page heavier. In my experience, we see this problem very quickly on a static pages (or SSR) that uses the same icon many times.
Ben offers a great, lesser-known alternative: using SVG sprites.
Extras:
trailingSlashStream: powerful Chat & Feeds for React & React-Native
Stream is the maker of enterprise-grade APIs and SDKs that help product and engineering teams solve two common problems at scale: in-app chat and social activity feeds.
With Stream, developers can integrate any type of messaging or feed experience into their app in a fraction of the time it would take to build these features from scratch. Stream Chat makes it easy for developers to integrate rich, real-time messaging into their applications.
Stream provides robust client-side SDKs for popular frameworks such as React, React-Native, Flutter, Android, Angular, Compose, Unreal and iOS. It also supports Expo managed workflow.
Unlock enterprise-grade features, functions, and UI components completely free for your startup or side project with the Maker Account.
loader, Next.js/getServerProps but for React-Navigation)A list of every web API in Deno
Luca (Deno contributor) mentions exhaustively all the web APIs supported by Deno. No surprise it's a good platform to deploy Remix applications.
This is probably in response to the new web APIs announced last week for Node.js 18. Also read: fetch() In Node.js Core: Why You Should Care.
Funny story, in a backend context but largely applicable to React apps. The usage of FP and immutability led to bad performances related to array copying and an O(n2) algorithm. Moving back to mutable code significantly increased the performances.
Note: it is also possible to get better performances with immutability by using vector tries and structural sharing, used internally by libs such as ImmutableJS.
Quirrel (serverless cron jobs SaaS) and its creator Simon (see his post) both join Netlify, which introduced a new Scheduled Functions feature in beta.
This kind of feature is clearly lacking in the current serverless landscape. Note that Blitz (Simon is a contributor) pivots to Blitz Toolkit to provide similar services. We couldn't be surprised to see Vercel make an offer 😏
Extras:
codeowners to monitor changes in libs public API surface 🤔interface rather than type where possible?"