@scottgross
Remember that you are using the Wix Location API, so you still need to be importing it at the top of your code as Sam linked in his reply previously
https://www.wix.com/corvid/reference/wix-location.html#url
import wixLocation from 'wix-location';
Also, as stated in the API info, make sure that your site is published first before testing it - If the site is not yet published, the function returns null.