Turbo + Stimulus: Show/Hide form fields based on the value of a select

I am still trying to get used to using turbo + hotwire to solve simple tasks like this one on the title.

I can definitely write a Stimulus controller to solve this particular problem, but I am not sure if this would be the easiest/most simple way to achieve it.

I need to show or hide other form fields based on the value of a select that will always be displayed on the form. How would you approach this?

Add a Stimulus controller to your form that targets the select element and the form fields you want to show/hide. Use data attributes to define which form fields should be shown for each select option. Write a Stimulus action that triggers when the select value changes. This action will read the selected value and toggle the visibility of form fields based on the data attributes.