I am developing an application in which I check if the user is not loggedIn. I have to display the login form, else dispatch an action
I was able to use history within stateless functional component, using withRouter following way (needed to ignore typescript warning):
import { withRouter } from 'react-router-dom';
...
type Props = { myProp: boolean };
// @ts-ignore
export const MyComponent: FC = withRouter(({ myProp, history }) => {
...
})