Getting started

Installation

Ensure you are using esbuild (enabled with JSX in .js)

Add the following to your Gemfile

# Gemfile
gem 'superglue'

Run bundle and the installation generator:

bundle
rails superglue:install:web

Contents

The above will also generate a redux toolkit starter that's configured to work with Superglue. You'll find:

  • A slice for the flash that works with the Rails flash

  • A pages slice that can be used for custom reducers

  • And application_visit.js that can be used to add before and after behavior for visit and remote

  • A store.js that puts the above together

  • And a [pre-configured entry point] in app/javascript/packs/application.js

For more information, visit the react redux section.

Scaffold

If you'd like to dive right in, you can work with a scaffold.

rails generate scaffold post body:string --force --no-template-engine --superglue

or proceed with a tutorial

Last updated