I am using React-router and I want to change page from a function. The function is called onclicking a button in sidebar . I could do it with swapping buttons to a Link tag in react-router. However I want some styles to apply then change the page to render new component. SO how to change page from a function.
I have tried history.push and redirect in react router but both didnt work.
history.pushis correct, so you might just be calling it wrong.