Are you sure your import should not be:
import Phoenix.Socket, only: [assign: 2, assign: 3] import Phoenix.Socket, only: [assign: 2, assign: 3] import Phoenix.Component, only: [assign: 2, assign: 3]
https://hexdocs.pm/phoenix_live_view/Phoenix.Component.html#...Importing from Socket should work, but you're right, the code in the post wouldn't work. They use to be in LiveView but got moved to Component.
Not that importing is useless but single-use imports drive me a bit nuts. Even just using it a few times. It's nice to be able to jump to some code and know exactly where everything is coming from without having to jump around the file.
I don't avoid import but I generally I strive to import one module where I'm going to be using many functions. I rarely bother with `only` unless it's absolutely necessary due to conflicts otherwise specifying `only` is a good indication I don't even need to import.