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:
- Building complex UIs
- 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
Retire. We have adopted Hotwire and Apollo over React, Slim, and Stimulus Reflex. No new UIs should be built with these tools. We will continue maintaining existing UI built with these tools that we have not yet ported to the new design system.