diff --git a/src/components/Header/CozyBar.spec.tsx b/src/components/Header/CozyBar.spec.tsx
index 1851681956997b1b2dc4114f4ec63024079454bc..d1959dc46aab77d0aab700104422b5e8994ea9b7 100644
--- a/src/components/Header/CozyBar.spec.tsx
+++ b/src/components/Header/CozyBar.spec.tsx
@@ -3,7 +3,6 @@ import { mount } from 'enzyme'
 import { Provider } from 'react-redux'
 import configureStore from 'redux-mock-store'
 import CozyBar from 'components/Header/CozyBar'
-import { history } from 'components/App'
 import * as ModalAction from 'store/modal/modal.actions'
 import { globalStateData } from '../../../test/__mocks__/globalStateData.mock'
 import { modalStateData } from '../../../test/__mocks__/modalStateData.mock'
@@ -19,6 +18,13 @@ jest.mock('cozy-ui/transpiled/react/I18n', () => {
   }
 })
 
+const mockGoBack = jest.fn()
+jest.mock('react-router-dom', () => ({
+  useHistory: () => ({
+    goBack: mockGoBack,
+  }),
+}))
+
 const mockStore = configureStore([])
 
 describe('CozyBar component', () => {
@@ -44,14 +50,13 @@ describe('CozyBar component', () => {
         <CozyBar displayBackArrow={true} />
       </Provider>
     )
-    const goBackSpy = jest.spyOn(history, 'goBack')
     expect(wrapper.find('BarLeft')).toHaveLength(1)
     wrapper
       .find('BarLeft')
       .find('.cv-button')
       .first()
       .simulate('click')
-    expect(goBackSpy).toHaveBeenCalled()
+    expect(mockGoBack).toHaveBeenCalled()
   })
 
   it('should call handleClickFeedbacks when feedback button is clicked', () => {
diff --git a/src/components/Header/CozyBar.tsx b/src/components/Header/CozyBar.tsx
index 4e907f4a00b54ddf2eed1ce989fc277ae2321c8d..089a4318be324361a0574e1033c59f7d7af33f16 100644
--- a/src/components/Header/CozyBar.tsx
+++ b/src/components/Header/CozyBar.tsx
@@ -3,7 +3,7 @@ import { useI18n } from 'cozy-ui/transpiled/react/I18n'
 import { useSelector, useDispatch } from 'react-redux'
 import { EcolyoState } from 'store'
 import { updateModalIsFeedbacksOpen } from 'store/modal/modal.actions'
-import { history } from 'components/App'
+import { useHistory } from 'react-router-dom'
 
 import { ScreenType } from 'enum/screen.enum'
 
@@ -21,6 +21,7 @@ const CozyBar = ({
   displayBackArrow = false,
 }: CozyBarProps) => {
   const { t } = useI18n()
+  const history = useHistory()
   const dispatch = useDispatch()
   const { BarLeft, BarCenter, BarRight } = cozy.bar
   const { screenType } = useSelector((state: EcolyoState) => state.global)
diff --git a/src/components/Header/Header.spec.tsx b/src/components/Header/Header.spec.tsx
index 40a0a70607c68ec1d139e95f8a1b47279b25f432..1b6f35c58878494817e97fda3610966ab628da30 100644
--- a/src/components/Header/Header.spec.tsx
+++ b/src/components/Header/Header.spec.tsx
@@ -2,7 +2,6 @@ import React from 'react'
 import { mount } from 'enzyme'
 import { Provider } from 'react-redux'
 import configureStore from 'redux-mock-store'
-import { history } from 'components/App'
 import * as ModalAction from 'store/modal/modal.actions'
 import Header from 'components/Header/Header'
 import { globalStateData } from '../../../test/__mocks__/globalStateData.mock'
@@ -19,6 +18,13 @@ jest.mock('cozy-ui/transpiled/react/I18n', () => {
   }
 })
 
+const mockGoBack = jest.fn()
+jest.mock('react-router-dom', () => ({
+  useHistory: () => ({
+    goBack: mockGoBack,
+  }),
+}))
+
 const mocksetHeaderHeight = jest.fn()
 const mockStore = configureStore([])
 
@@ -92,13 +98,12 @@ describe('Header component', () => {
         />
       </Provider>
     )
-    const goBackSpy = jest.spyOn(history, 'goBack')
     wrapper
       .find('StyledIconButton')
       .find('.header-back-button')
       .first()
       .simulate('click')
-    expect(goBackSpy).toHaveBeenCalled()
+    expect(mockGoBack).toHaveBeenCalled()
   })
 
   it('should call handleClickFeedbacks when feedback button is clicked', () => {