Error using function to() with a button to redirect to a web

import wixWindow from ‘wix-window’;
import wixLocation from ‘wix-location’;

export function GoSite() {

wixLocation.to("https://www.youtube.com"); 

}
I have created the export function GoSite() activating the onclick event to the button. I want that When I click on the button, this redirects me to that web address … But My function is not working. The button doesn’t do redirection to the link inside of to(). Why’ and How Can I get it?