I have a custom hook which wraps setState function so I can do something with the values as they are passed into the setter.
In this case, setState either takes a string value or a callback with the prev value of the state:
setState((prev) => (prev +' world')); // hello worldconst useHook = () => { const [stateValue, setStateValue] = useState('hello'); const setWrapper = (value: string | (prev: string) => string) => { // how can I get the result of (prev) => string here // aka 'hello world' value. } return [stateValue, setWrapper]}How can I get the return value passed to setWrapped if a callback with prev was used?