React and Slim in Astra

Description

You can choose between two different paradigms for building UIs in Astra: React and Slim. The choice is somewhat subjective, with some gray areas in the middle. Historically, when we started using React in Astra, it was primarily to make two things easier:

  1. Building complex UIs
  2. Building an SPA where changing pages was fast due to the Redux cache and client-side router

More recently, we started using Turbolinks and Stimulus Reflex, which allow us to navigate faster and to update the current page with new data from the server. The combination of Turbolinks and Stimulus Reflex should, in most situations, cover the second use case above.

Building complex UIs is still probably best done in React. A finger in the wind type test would be to ask yourself how much JavaScript a view will need. While it’s possible to build a complex UI in jQuery, it’s also much less maintainable.

Generally, default to Slim unless you have a compelling use case for React.

Technology Status at Wunder

Slim with Stimulus Reflex: Adopt This should be the default tool for building UIs in Astra.

React for Complex UIs: Adopt

React for Simple UIs: Discouraged