Skip to content

Instantly share code, notes, and snippets.

@jaytaylor
Created July 12, 2017 22:44
Show Gist options
  • Save jaytaylor/b14716671ae6a8cd057bd6d849670238 to your computer and use it in GitHub Desktop.
Save jaytaylor/b14716671ae6a8cd057bd6d849670238 to your computer and use it in GitHub Desktop.
Solution for "Unexpected use of 'location'" React error.
React: Unexpected use of 'location';

Solution: Use window.location instead of bare location.

@ekebobrown
Copy link

why we have to access location object through window even window is global object , can anyone answer it ,it will help me and other as well --thank you.

Please did you get a response to this anywhere?

@CaioLuColaco
Copy link

thanks

@stefaniafrolovafrolov
Copy link

Спасибо) Это сработало) Ранее я window с location не использовал.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment