I am working on an anime project. My problem is that when I click the input, I want to bring it to the forefront. So, I used "webkitRequestFullscreen()", but I cannot toggle my boolean to true in order to make it. I looked for some solutions, but I guess, the version I use for Redux is different from theirs and I didn't understand them.
Here is my initial state and reducer function:
const initialState = {
items: [],
fullScreen: false,
}
reducers: {
toggleInputScreen: (state, action) => {
const id = action.payload
state.fullScreen = !state.fullScreen
},
},
The main component:
let activeFullScreen = useSelector((state) => state.anime.fullScreen)
// console.log(activeFullScreen)
if (activeFullScreen) {
return inputRef.current.webkitRequestFullscreen()
}
<div
className="input-container"
onClick={() => dispatch(toggleInputScreen())}
id="input-div">
<input type="search" placeholder="Search..." ref={inputRef} />
</div>
I know the reducer function is a total disaster. How can I toggle the fullScreen boolean when I click the input? Thanks in advance.