I want to go to other pages in my react project using a router-react-dom. I created a function like this:
const {id} = props;
const redirect = () => {
console.log("redirecting...");
const url = `/${id}`;
return <Redirect to={url} />;
};
Then I make props to other component like this:
<BtnDetalii
clickFn={redirect}
text="apasa aici pentru mai multe detalii"
/>
and this is my btnDetalii component
const BtnDetalii = props => (
<div onClick={() => props.clickFn()} className="detalii">
{props.text}
</div>
);
When I click the buton doesn't work. What I missed?