Hi Brett, thanks for sharing your code with us.
When I copy and paste your code in my own project though, I get this linting error:
"Parsing error: Cannot read property 'map' of undefined"
I think it has to do with this line of code: "const useQueryParam = ( key: string, defaultVal: string): [string, (val: string) => void] => {"
When I remove the part ": [string, (val: string) => void]" the error message is gone, but things don't work anymore.
I'm new to Typescript, could you explain what is happening in this line of code and perhaps share any ideas on how to fix the linting error?
Thanks in advance.
Remco Hoff
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Brett, thanks for sharing your code with us.
When I copy and paste your code in my own project though, I get this linting error:
"Parsing error: Cannot read property 'map' of undefined"
I think it has to do with this line of code: "const useQueryParam = ( key: string, defaultVal: string): [string, (val: string) => void] => {"
When I remove the part ": [string, (val: string) => void]" the error message is gone, but things don't work anymore.
I'm new to Typescript, could you explain what is happening in this line of code and perhaps share any ideas on how to fix the linting error?
Thanks in advance.
Remco Hoff