JSFiddle - React, Tailwind, and code Playground
HTML
<form name="ff">
<select id="type" name="type">
<option value="0">Federal</option>
<option selected="selected" value="1">Estadual</option>
<option value="2">Municipal</option>
</select><br>
<div id="state" >
<label>Estado</label>
<input type="text" name="state"/> <br>
</div>
<div id="city">
<label>Cidade</label>
<input type="text" name="city" /><br>
</div>
<label>Nome</label>
<input type="text" name="name" id="name" />
</form>
JavaScript
$(document).ready(function() {
$('#type').change(function() {
$('#state').hide();
$('#city').hide();
if ($('#type').val() == 1) {
$('#state').show();
}
else if($('#type').val() == 2) {
$('#state').show();
$('#city').show();
}
});
$("#type").change();
});