React JS Usehistory

Route needs to exist

1
2
3
4
5
6
<Route path="/editschedule/:id">
<EditSchedule
equipment={equipment}
interval={interval}
schedule={schedule} />
</Route>

Then use the hook to navigate

1
2
3
4
5
let history = useHistory();

function handleClick(id: string) {
history.push("editschedule/" + id);
}