The Republicans were very successful at gerrymandering in states where they started with a majority and they used racial data to do it. It's called Project REDMAP.
For example, Georgia: In 2016, the overall state percentage of voters was 45.35% for Clinton and 50.44% for Trump, which seems like a moderately close race. But only 5 out of 14 representatives (36%) are Democrats. If you look at the breakdown of the presidential race by congressional district you can see that the voting strongly correlates to race but most of the non-white people in Georgia are packed into only four congressional districts.