What should I pay attention to when traveling by boat?
Attention can be directly followed by a noun, pronoun or gerund, but it is worth noting that to is a preposition here, not an infinitive, and it is the same as look.
pay attention to
use
Pay attention to doing sth.
Pay attention to sth.
Because to is a preposition here.
take for example
Pay attention to national affairs.
Concerned about national affairs
Please take care of your baby.
Please take good care of your children.