How do you cope with such an intensely painful issue like a dying baby?

Love. With the help of a loving family. If religion is important, this can help enormously but it must be sincere. It will take a long time to adjust but you will always remember it through life. Believing in god and life after death is good.