You are using the beta version of react-router-dom. In v6, useHistory is
replaced by useNavigate
https://dev.to/zenveus/routing-with-react-router-v6-6b1
If you want to use useHistory you should install v5 instead.
const navigate = useNavigate();
const onSavePostClicked = () => {
if (name && description) {
dispatch(todoUpdated({ id: todoId, name, description }));
navigate(`/todo/${todoId}`);
}
};