I'm new to React hooks, and have run across this code:
const multiply = useCallback((value: number) => value * multiplier, [multiplier]);
(from https://medium.com/@jrwebdev/react-hooks-in-typescript-88fce7001d0d)
This is confusing to me and Visual Studio Code, which reports this error:
Cannot find name 'multiplier'. Did you mean 'multiply'?ts(2552)
I feel that I know Typescript reasonably well, but I don't understand [multiplier] or how to resolve this issue. I suppose it's correct Typescript (it does seem to actually compile). Can someone explain to me how this syntax works and how to get Visual Code Studio to accept it? Or if it needs to be fixed?