My grand and greatgrandparents had hives. How can I avoid it?

What will be will be. Fortunately hives don't run in families so you are at no greater risk than anyone else. About 1 in 12 people have hives at some point in their lives.
Avoid known allergen. Hives are common. It is estimated that 20% of the population will have hives at some point. Genetics probably plays some role in hives. If you know you are allergic to a food or drug, you must avoid that. Many cases of hives occur in relationship to viral illness, and those cannot be avoided., most cases of hives respond to antihistamines.