'Is there a way to use 'Show Call Hierarchy' on useState setters in Visual Studio Code?
The feature seems to work for most regular functions, and even the components themselves when using functional components, but nothing is returned for the useState provided setter functions.
Example
import React, { useEffect, useState } from 'react';
type Props = {}
const Example: React.FC<Props> = (props: Props) => {
const [value, setValue] = useState<number>(0);
useEffect(() => {
wrapperFunction();
});
const wrapperFunction = () => {
changeValue();
}
const changeValue = () => {
setValue(7);
}
return (
<span>Hello, World!</span>
)
};
export default Example;
Using 'Show Call Hierarchy' on changeValue would return a list including wrapperFunction since it was called within that function. But using 'Show Call Hierarchy' on setValue returns No results in the References sidebar.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
