How can you spank your kids?

I’m really open minded and ive thought about spanking as a punishment. My baby is obviously too young to be disciplined. At my family’s Easter dinner, my three year old cousin went to touch a guitar and the pick accidentally slid down and into the hole of the guitar. I told my uncle it was no big deal but he yelled at her and told her he was going to spank her. She started crying and said “Please don’t do it.” It broke my heart and I don’t think I’ll ever be able to hit my daughter after witnessing it.