Created
February 10, 2023 18:42
-
-
Save gtchakama/81f93bccc3f588276672237525655e7c to your computer and use it in GitHub Desktop.
When using React hooks there is no access to access to this.props.location. To capture url parameters use window object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getParams = () => { | |
| const search = window.location.search; | |
| const params = new URLSearchParams(search); | |
| const TokenParam: any = params.get('token'); | |
| console.log(TokenParam); | |
| } | |
| useEffect(() => { | |
| getParams() | |
| }, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment