When I call .enter or .exit the state of one of my variables is reset to its default state. Any idea how to stop this?
Update: I fixed this issue using a useRef and a. useEffect to watch the previous state of the variable and use that to update my variable accordingly.
I think the reason for the state resetting might be since I'm using React's createPortal for a modal image carousel on which I use this fullscreen package so it might not have been the package at all. When I console logged the variable upon entering the fullscreen api, its state was reset so I just added an if statement to signal out this condition and give me the expected result while also adding a state update after calling .enter() to update the variable based on the useRef's previous value that I needed to stay consistent and not reset.
When I call .enter or .exit the state of one of my variables is reset to its default state. Any idea how to stop this?
Update: I fixed this issue using a useRef and a. useEffect to watch the previous state of the variable and use that to update my variable accordingly.
I think the reason for the state resetting might be since I'm using React's createPortal for a modal image carousel on which I use this fullscreen package so it might not have been the package at all. When I console logged the variable upon entering the fullscreen api, its state was reset so I just added an if statement to signal out this condition and give me the expected result while also adding a state update after calling .enter() to update the variable based on the useRef's previous value that I needed to stay consistent and not reset.