i want to refactor the below ifelse code
below is my code,
const toggle = React.useCallback(
async (itemId: string) => {
if (isDrawing && editItemId === itemId) {
cancelDrawing();
} else if (isDrawing) {
cancel();
itemId && startDrawing(itemId);
} else {
itemId && startDrawing(itemId);
}
}
);
could someone help me with this. thanks.