Some foreigners are afraid to travel to South Africa if they are white, especially to areas that saw a lot of anti-apartheid resistance, such as Johannesburg, because they’re afraid of racial resentment.
However, there is no racism against white tourists (and Black South Africans are still the most disenfranchised in the country). If someone does attack you, it’s because you are a foreigner, which singles you out as wealthier than most South Africans, not because you’re white.