How to Pass React State to Normal Function (External Function)

I am Trying the Achieve Passing the React States to External Function Here is the Example Which I Tried

In Tsx File


const [Toggle,setToggle] = useState(false);
const ToggleHandler = () => {
setToggle(!Toggle);
};

useEffect(() => {
GetToggleValue(Toggle);
},[Toggle])

In ts File


External Function

const GetToggleValue = (toggle:boolean) => {
console.log(toggle);

As You Seen I have Passed toggle as Params to GetToggleValue But it Prints Only the Initial State if State Changes in Tsx File its not Updated in External Function
Would Anyone have the Solution for this to fix it