Job-hopping is okay
Job-hopping is okay, provided it is managed properly. This is because the more you hop, the harder it is to convince your next employer to hire you. After all, the whole hiring process can be costly and time-consuming. No employers relish the prospect of hiring a candidate who would resign within a year. Not to mention the amount of resources spent on training the candidate.
So how long should we stay before moving on to the next company? My take is a minimum stay of two years. One of my ex-bosses shared with me that typically it takes about one year to train a worker up to speed and another year for the person to contribute meaningful to the organization. So probably you need to stay for at least two years in order to reflect some credible achievements in your resume.
Knowing what you want
I think no one enjoys job-hopping. After all, it can be quite a pain in the ass to learn everything all over again. So my advice is even if you have to switch job, make sure the next one is still within the same industry. Then at least you would still retain the basic foundation knowledge and skills and need not start from scratch in your new company again.