You can access the history object in a functional component by calling the useHistory hook: const history = useHistory().