How can you deal with learning that a loved one has cancer?

Take care of you. It is always tough news to handle. Aside from providing your loved one with support and encouragement, you have to make sure that you're healthy as well. This can mean talking with a confidant, journaling, doing something to distract you, or even talking with a medical professional in the event that you're emotionally struggling with your feelings/reactions.
It's hard. Being supportive of the loved relative. Understanding what type and stage the cancer is in and has everything that's supposed to be done is being done. Perhaps the cancer is beatable. If not cureable doing everything you can reasonably do to support and be there for that person. That person may need help in daily activities. All of this will portray your love and in return help you cope.