JSFiddle - React, Tailwind, and code Playground

JavaScript

$(function() {
    //This hides all initial textboxes
    //$('label').hide();
    $('#cat').change(function() {
        //This saves some time by caching the jquery value
        var val = $(this).val();
        //this hides any boxes that the previous selection might have left open
        $('#subcategory').hide();
        //This just opens the ones we want based off the selection
        $('.' + val).show();
    });
    
});