Prefer && over ?

Let’s start with code.

{lessonIds && lessonIds[lessonIds.length - 1] != lesson.id ? (
  <Button
    className="mx-2"
    label="Next"
    onClick={() => handleNextButton(lesson.id)}
   />
) : null}

In the above case we can use && and that would make code more readable and we do not have to worry about returning a null.

{lessonIds && lessonIds[lessonIds.length - 1] != lesson.id && (
  <Button
    className="mx-2"
    label="Next"
    onClick={() => handleNextButton(lesson.id)}
   />
)}