Toddlers spend a great deal of their time observing you, learning new things, trying to understand limits... pushing said limits.
It is out job to teach them the rules of living in society, to act kindly, to respect other people, to act safely, etc.
Multiple studies prove that spanking and negative discipline not only damage your child, and your relationship with him/her, but also don't teach your child to act with kindness and respect. Rather, you may end up with an aggressive child that hits other kids at school, does poorly at playdates, etc.
Here's what to do: