stenciljs/eslint-plugin

How to resolve "Use vDOM listener instead"

Open

#10 aberto em 6 de abr. de 2020

Ver no GitHub
 (13 comments) (2 reactions) (0 assignees)TypeScript (37 forks)auto 404
Help Wantedtriage

Métricas do repositório

Stars
 (71 stars)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

Noobie question — I’m using an example straight from the Stencil docs…

@Listen('keydown')
handleKeyDown(ev: KeyboardEvent){
  if (ev.key === 'ArrowDown'){
    console.log('down arrow pressed')
  }
}

I get an error Use vDOM listener instead, and I don’t exactly know how to resolve that… 😬 In other words, I don't exactly know how to "use a vDOM listener instead".

Also, according to the rule docs, this rule is meant to "Ensures that no vdom events are used in @Listen decorator." Why is it bad to listen to vDOM events using the @Listen decorator?

Guia do colaborador