debian-image-builder-frontend/src/App.js
Sanne Raymaekers 4c1a6c223d App: explicitly pass the store to the NotificationsPortal
Because of mismatched redux versions between NotificationPortal and our
app, the former couldn't automatically discover the store.

Also drop reregister of notificationsReducer, we already register it in
store.
2022-10-06 11:56:25 +02:00

33 lines
908 B
JavaScript

import React, { useEffect } from 'react';
import { useStore } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import '@patternfly/patternfly/patternfly-addons.css';
import NotificationsPortal from '@redhat-cloud-services/frontend-components-notifications/NotificationPortal';
import { Router } from './Router';
const App = (props) => {
const navigate = useNavigate();
const store = useStore();
useEffect(() => {
document.title = 'Image Builder | Red Hat Insights';
insights.chrome.init();
insights.chrome.identifyApp('image-builder');
const unregister = insights.chrome.on('APP_NAVIGATION', (event) =>
navigate(`/${event.navId}`)
);
return () => {
unregister();
};
}, []);
return (
<React.Fragment>
<NotificationsPortal store={store} />
<Router childProps={props} />
</React.Fragment>
);
};
export default App;