Using a selector declared in a public js file.. Is it a bad idea?

I have a wix page wtih a TextBox

Page code :

import { $text } from 'public/test.js';

$w.onReady(() => {
   
      $text.text = 'some text';

});

public/test.js

export const $text = $w('#text');

This works but is this bad practice or has potential issues?