How to get a node type in Drupal 10

To get node object using node parameters,

$node = \Drupal::routeMatch()->getParameter('node');

if (!$node) {

  return;

}

$title = $node->bundle();

Category