If array of user_list.length == 0, the "clear user" button should be disabled. When I am calling this.disabledButton function, it throws an error saying
Type '() => boolean' is not assignable to type 'boolean'
Below is my logic.
<section>
<Button
id='clear-user'
disabled={this.disabledButton}
onClick={this.onClearAllUserButton}>
{'Clear User List'}
</Button>
</section>
Function defined:
private disabledButton= (): boolean => {
if (this.props.user_list.length == 0) {
return true
}
return false
}
Is my calling wrong?
disabledprop accepts a boolean value,disabledButtonis a function that returns a boolean value. A function is not assignable to a boolean.