Everybody has to deal with the grave. Everybody deals with grave things differently.
Levity is my way of dealing with gravity. I become completely insincere, make jokes, and generally avoid any actual concerns. This is how I deal with everything serious. Loss of life, loss of job, loss of relationship, all of them are fodder for insensitive jokes. Kinda makes me seem like a jerk (and rightly so), but that is simply how I handle the stress that comes from grave situations.
The more common response is to become grave. Serious situations need to be taken seriously and treated seriously. Jokes are inappropriate and only hurt people in a vulnerable state.
I agree with the common response (kinda). People are in a vulnerable state and should not be hurt. But through levity, I remove myself from being in a vulnerable state. I box up the weakness with insincerity. Then I'm untouchable.
Some people like to lose themselves in a crowd. The hustle and bustle and activity keeps their minds too busy to actually deal with the serious situation at hand. Most writers I know, though, do the opposite. They sit down by themselves and work through those feelings. Some writers I know exclusively write in order to work through their feelings.
However you deal with gravity, it shows who you are. Learn from that. Learn who you are. And use that when you write.