Skip to content

Commit ef8a264

Browse files
authored
Merge pull request #5035 from fedspendingtransparency/fix/dev-14177
DEV - 14177: Remove use of DefaultProps in Spending Explorer
2 parents 86833fd + f5f81cc commit ef8a264

File tree

3 files changed

+157
-176
lines changed

3 files changed

+157
-176
lines changed

src/js/components/explorer/ExplorerWrapperPage.jsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ const propTypes = {
1818
showShareIcon: PropTypes.bool
1919
};
2020

21-
const defaultProps = {
22-
showShareIcon: false
23-
};
24-
2521
require('pages/explorer/explorerPage.scss');
2622

2723
const slug = 'explorer';
2824
const emailSubject = 'USAspending.gov Federal Spending Explorer';
2925

30-
const ExplorerWrapperPage = (props) => {
26+
const ExplorerWrapperPage = ({
27+
showShareIcon = false,
28+
children
29+
}) => {
3130
const dispatch = useDispatch();
3231
const handleShareDispatch = (url) => {
3332
dispatch(showModal(url));
@@ -45,21 +44,20 @@ const ExplorerWrapperPage = (props) => {
4544
classNames="usa-da-explorer-page"
4645
title="Spending Explorer"
4746
metaTagProps={explorerPageMetaTags}
48-
toolBarComponents={props.showShareIcon ? [
47+
toolBarComponents={showShareIcon ? [
4948
<ShareIcon
5049
onShareOptionClick={handleShare}
5150
url={getBaseUrl(slug)} />
5251
] : []}>
5352
<main
5453
id="main-content"
5554
className="main-content">
56-
{props.children}
55+
{children}
5756
</main>
5857
</PageWrapper>
5958
);
6059
};
6160

6261
ExplorerWrapperPage.propTypes = propTypes;
63-
ExplorerWrapperPage.defaultProps = defaultProps;
6462

6563
export default ExplorerWrapperPage;

src/js/components/explorer/detail/ExplorerDetailPage.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Created by Kevin Li 8/16/17
44
*/
55

6-
import React, { useState } from 'react';
6+
import React, { useCallback, useState } from 'react';
77
import DetailContentContainer from 'containers/explorer/detail/DetailContentContainer';
88
import ExplorerWrapperPage from '../ExplorerWrapperPage';
99
import ExplorerTooltip from './visualization/ExplorerTooltip';
@@ -22,14 +22,14 @@ const ExplorerDetailPage = () => {
2222
isAward: false
2323
});
2424

25-
const showTooltipFn = (position, data) => {
25+
const showTooltipFn = useCallback((position, data) => {
2626
setShowTooltip(true);
2727
setTooltip(Object.assign({}, position, data));
28-
};
28+
}, []);
2929

30-
const hideTooltipFn = () => {
30+
const hideTooltipFn = useCallback(() => {
3131
setShowTooltip(false);
32-
};
32+
}, []);
3333

3434
let tooltipUi = null;
3535

0 commit comments

Comments
 (0)