You are aware of the curse of dementia [mainly as Alzheimer’s Disease – AD] either as a risk of ageing or more powerfully because of personal experience of a sufferer.
There IS an inherited ie genetic component related principally to the APOE e4 gene. But lots of people who have the gene don’t get AD. The important information is not whether you have the gene [so don’t rush to get a test] but whether the gene is switched on - this is called gene expression.