Getting started with Phlex on Rails
While Phlex can be used in any Ruby project, it’s especially great with Rails. But before we get into the details, it’s important to understand that Phlex is very different from ActionView and ViewComponent.
To use Phlex with Rails, you’ll need to install the
phlex-rails gem. Add the following to your Gemfile and run
Note, you do not need to install
phlex separately because
phlex is a dependency of
Once the gem is installed, run the install generator.
bin/rails generate phlex:install
This script will:
app/views/layoutsin your auto-load paths;
ApplicationComponent is your base component which all your other components inherit from. By default,
ApplicationView inherits from