import fooImg from "./img/foo.jpg"
import barImg from "./img/bar.jpg"
const getImg = (name) => {
switch (name)
{
case "foo": return fooImg;
case "bar": return barImg;
......
}
}
import { useHistory } from "react-router-dom";
const history = useHistory()
return (
<button type="button" onClick={() => history.goBack()}>
Go back
</button>
);