There is a component that must be build which must receive a function for onClick. The problem is that the function is not defined yet so it must receive some 'empty' function in order to pass the tests.
This is the code:
<Button
title='MyTitle'
className='my-class-name'
onClick={
() =>
/* eslint-disable no-console */
console.log('test')
/* eslint-enable no-console */
}
/>
So I added a console.log()
but eslint doesn't like it so the comments before and after it were added.
Is there a way to put a function that doesn't do anything just to pass the linting?
CodePudding user response:
The function can just return null:
<Button
title='MyTitle'
className='my-class-name'
onClick={() => null}
/>
CodePudding user response:
Maybe try returning void instead?
onClick={() => void0}
CodePudding user response:
Use this:
<Button
title='MyTitle'
className='my-class-name'
onClick={
() => undefined
}
/>