
Vite Rails is also an excellent choice for React, Vue JS, Solid JS, or any other Rails API app where you want a JS paradigm to control the front end. Shakapacker comes ready to go for including assets in Javascript, works in tandem with the react-rails gem, and is an ideal React & TypeScript development environment on top of Ruby on Rails 7. With modification and significant configuration, you can get React to work with JSBundling, but it cannot smoothly pull assets (import them into components) out of the box. Typescript can be easily added to a JSBundling app, as long as you add the Typescript watcher and reconfigure your Yarn script. No, React and Typescript will not work with ImportMap-Rails.
#RAILS 7 REACT UPGRADE#
Starting with Rails 7.0, you can upgrade from Sprockets to Propshaft, the next generation of Rails asset pipeline.Ĭan I use React and TypeScript with any paradigm? However, if you have a more React-style application tree with styles defined inline or in your JS code, you can use that paradigm instead if you are using Shakapacker or Vite Rails. The asset pipeline (sprockets) remains the default Rails deployment paradigm for loading CSS through the stylesheet_link_tag Rails helper in your layout file, even through Rails 7.0, although it is being phased out in favor of Propshaft. How much should I use the asset pipeline, Sprockets or Propshaft? Yes, Stimulus will work with either ImportMap-Rails, JSBundling, Shakapacker, or Vite Rails. Yes, Turbo will work with either ImportMap-Rails, JSBundling, Shakapacker, or Vite rails. Yes, Bootstrap or Tailwind will work with either ImportMap-Rails, JSBundling, Shakapacker, or Vite rails. If you want Shakapacker, see Shakapacker Setup.Ĭan I use Bootstrap or Tailwind with any paradigm?

Want JSBundling instead? See Up & Running JS Bundling. Rails 7: ImportMap-Rails with Bootstrap, Stimulus, Turbo, (Quick Setup) Rails 7: ImportMap-Rails with Bootstrap, Stimulus, Turbo (Long Tutorial). Want Importmap for my Rails 7 app with Bootstrap? Once you decide, the fastest way to get started with a new Rails 7 app is to use my Rails Quick Scripts - which are easy to use and get you up & running right away, leaving you with excellent sane defaults and instantaneous basic configuration.


(Note: Importmaps is a paradigm for working with Javascript, but it isn’t actually a “packager.” The other 3 options can be considered “packagers.”) For getting Bootstrap to work with Rails 7, you need to choose between ImportMap, JSBundling/ CSSBundling, Shakapacker, or Vite Rails as your Javascript packager or paradigm.
