How can I hide or show fields using states with hook form alter
It seems you re using the Drupal 7 syntax. For Drupal 8 this is slightly different.

You can implement hook_form_alter() as follows to change the visibility state of a form element as follows:

/**
 * Implements hook_form_alter().
 */
function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if($form_id == 'node_article_edit_form') {  
    $form['field_other']['#states'] = [
      'visible' =&gt; [
          'select[name="field_reason"]' =&gt; ['value' =&gt; 'other']
      ]
    ];
   }
 }


This will make the field_other field visible if the other option is chosen in the reason select list.