Add the turbo-mount gem to your Gemfile:
gem 'turbo-mount'
If your project uses build tools like Vite, also install the turbo-mount npm package:
yarn add turbo-mount
Import the necessary modules and initialize TurboMount with your application and the desired plugin:
import { Application } from "@hotwired/stimulus";
import { TurboMount } from "turbo-mount";
import plugin from "turbo-mount/react";
import { SketchPicker } from 'react-color';
const application = Application.start();
const turboMount = new TurboMount({ application, plugin });
turboMount.register('SketchPicker', SketchPicker);
And finally, add the component to your view:
<%= turbo_mount_react_component("SketchPicker", props: {color: "#430"}) %>