Answer:
Nightmares are usually caused due to,
Stress,like problems at school or home.
OR
Anxiety caused by change, like move or death of a loved one.
Prevention:
Try talking to someone about it,
Or sleeping with a night light
You can also try some relaxing practice (anything that keeps you relaxed and happy) before bedtime.