I have some input masks on my code, a grid of buttons, and I have a state that stores which button is selected, and based on the selected button I want to change the mask applied to the input.
The state:
const [selectedButton, setSelectedButton] = React.useState("");
I've tried this:
const [input, setInput] = useMask(
selectedButton === "Key1" ? maskOne : maskTwo
);
It works perfectly! But only with 2 masks, I have 4 different masks, and I need some switch case type structure to choose which mask to apply