How to avoid getting razor bumps

When ever I shave the first or second day there aren't any bumps then the next day they start coming in and it makes me hate shaving and my bf says he doesn't mind hair but once in a while id like to shave without having to be embarrassed about razor bumps they are so painful too. Please help