Skip to content

Commit 95d9a4f

Browse files
committed
client/modules/App/App: update to named export & resolve typeerrors
1 parent a8eddf0 commit 95d9a4f

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

client/modules/App/App.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import PropTypes from 'prop-types';
21
import React, { useEffect, useRef, useState } from 'react';
32
import { useDispatch, useSelector } from 'react-redux';
43
import { useLocation } from 'react-router-dom';
@@ -7,26 +6,29 @@ import { DevTools } from './components/DevTools';
76
import { setPreviousPath } from '../IDE/actions/ide';
87
import { setLanguage } from '../IDE/actions/preferences';
98
import { CookieConsent } from '../User/components/CookieConsent';
9+
import type { RootState } from '../../reducers';
1010

11-
function hideCookieConsent(pathname) {
11+
function hideCookieConsent(pathname: string) {
1212
if (pathname.includes('/full/') || pathname.includes('/embed/')) {
1313
return true;
1414
}
1515
return false;
1616
}
1717

18-
const App = ({ children }) => {
18+
export const App = ({ children }: { children?: React.ReactNode }) => {
1919
const dispatch = useDispatch();
2020

21-
const location = useLocation();
21+
const location = useLocation<{ skipSavingPath?: boolean }>();
2222

23-
const theme = useSelector((state) => state.preferences.theme);
23+
const theme = useSelector((state: RootState) => state.preferences.theme);
2424
useEffect(() => {
2525
document.body.className = theme;
2626
}, [theme]);
2727

2828
// TODO: this is only needed for the initial load and would be better handled elsewhere - Linda
29-
const language = useSelector((state) => state.preferences.language);
29+
const language = useSelector(
30+
(state: RootState) => state.preferences.language
31+
);
3032
useEffect(() => {
3133
dispatch(setLanguage(language, { persistPreference: false }));
3234
}, [language]);
@@ -57,13 +59,3 @@ const App = ({ children }) => {
5759
</div>
5860
);
5961
};
60-
61-
App.propTypes = {
62-
children: PropTypes.element
63-
};
64-
65-
App.defaultProps = {
66-
children: null
67-
};
68-
69-
export default App;

client/routes.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useEffect } from 'react';
33
import { useDispatch } from 'react-redux';
44
import { Route as RouterRoute, Switch } from 'react-router-dom';
55

6-
import App from './modules/App/App';
6+
import { App } from './modules/App/App';
77
import IDEView from './modules/IDE/pages/IDEView';
88
import FullView from './modules/IDE/pages/FullView';
99
import { About } from './modules/About/pages/About';

0 commit comments

Comments
 (0)