To fix ‘Switch’ is not exported from ‘react-router-dom’ with React Router, we should use version 5 of React Router.
First we uninstall the existing version of React Router with
npm uninstall react-router-dom
Then install the version 5.2.0 of react-router-dom
npm install react-router-dom@5.2.0