Avoid empty system callbacks.
You are advised to modify the code to comply with the ArkUI programming specifications.
// code-linter.json5
{
"rules": {
"@performance/hp-arkui-avoid-empty-callback": "suggestion",
}
} @Component
struct MyComponent {
doSomething() {
// Service logic
}
build() {
Button('Click', { type: ButtonType.Normal, stateEffect: true })
.onClick(() => {
this.doSomething()
})
}
} @Component
struct MyComponent {
build() {
Button('Click', { type: ButtonType.Normal, stateEffect: true })
.onClick(() => {
// No service logic
})
}
} plugin:@performance/all
For details about how to configure Code Linter check rules, see Code Linter.