Making Hotwire play nice with ViewComponent

13-May-2021 1726
Have you ever wondered if you could use hotwire with view_component instead of partials. If you have, maybe tried and failed, welcome here.By default hotwire is made to work with partials, which is the built in way to extract 'components' in the context of rails based apps. In a certain application I was building I have used view_component (inspired by react) in place of partials because it is a framework for building reusable, testable .
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle