My column where I added OnClick function when I click
<Col onClick={()=>optionSelected("usermanagement")}
className={
currentSelection === "usermanagement" ? "selectedOp" : "option"
}
tabIndex="-1"
style={{ cursor: "pointer" }}
>
Well, This may look dumb way to access the route but I want this for some other purpose .
function optionSelected(optionName) {
if (optionName === "usermanagement") {
setCurrentSelection("usermanagement");
history.push("/" + currentSelection);
}
if (optionName === "foodcatalog") {
setCurrentSelection("foodcatalog");
history.push("/" + currentSelection);
}
if (optionName === "promotions") {
setCurrentSelection("promotions");
history.push("/" + currentSelection);
}
if (optionName === "tickets") {
setCurrentSelection("tickets");
history.push("/" + currentSelection);
}
if (optionName === "reports") {
setCurrentSelection("reports");
history.push("/" + currentSelection);
}
}
Why I can access the page (history push) only on the second click ?