classList.add method doesn’t work and component is rerendered when clicking file input in Svelte
I want to make the image upload box open and close. In my code, the opening function works, but for some reason, the closing function doesn’t work. Additionally, when I use console.log in the functions responsible for opening and closing, the console.log in the closing function runs twice. I also tried using another approach variable = !variable, but this approach has problem when the file input button is clicked, it causes the page to rerender, which resets the state variable to false, causing the box to close again. Does anyone know how to fix this?