Hi, unfortunately it's not possible. In React hooks can be defined only at top-level of the component function. Your best approach would be to trigger a state change from the function and useEffect on the outside. Otherwise, if all you need is immediate access to most up-to-date state value, it's also ok to copy the content to a ref on set. Hope this helps.