1.This the correct way of doing something.
Or,
2.This is the correct way to do something.
Use number 2.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
Both are correct. The infinitive is common in spoken English.
CB