Is it OK to use setX not at top level?

It says that one of the rules for hooks is to only use them at top level.

Is it ok to use setX in a loop though?

I assume you just aren’t supposed to use useState() and useEffect(), but want to make sure.