Is there a way to make a custom React component that could be used as a condition in Reducer function that is used in useReducer hook? I want to change native alert and confirm, that return true or false, however I cannot use It inside other hook only in the component, and I have a reducer function in a separate file, and quite complex logic in there and a function that triggers window.confirm like so
return isHoliday(day) &&
(msg
? window.confirm(
`a question to ask`
)
: true)
I have red many tutorials on how to make custom confirmation popup but they are all used inside components body not inside reducer, and I don't know how to return false from the component as i cannot have state or anything like that in the file with just reducer fn. Just a pseudo code with the steps needed would be great, I want to try to code it myself :) thanks