Formula fed

Hi all my baby girl is just over 3 weeks and she’s formula fed but for the past week she’s been having trouble pooping and they’re quite hard and she cries when she’s pushing to do a dirty nappy. Is there anything I can do to help I’ve tried massaging her belly, I give her cooked boiled water in between feeds as well