onClick()
is not correct, what should I write instead?
index.js:
import onClick from "./onClick.js";
const ref = document.querySelector('h1');
ref.addEventListener('click', (evt) => {onClick(evt, ref)}
onClick.js:
export default function onClick(evt, ref) {
console.log(evt);
ref.removeEventListener('click', onClick)
};