On hook_entity_presave how do I now if it is a new node? I'm using the hook

function nvgh_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
}


but I only need to do something when the node is new (not when it is edited). How to do this? I'm inspecting the entity with kint but cannot find a good indicator for this... also kint is disappearing as the node view is redirected into view modes.

How to do this?
Use the Entity::isNew() method:

if ($entity-&gt;isNew()) {
  // ...
}