Skip to content

Commit 29e1e6d

Browse files
committed
RouterTab: add typescript & install @types/react-router-dom
1 parent d376207 commit 29e1e6d

File tree

3 files changed

+65
-8
lines changed

3 files changed

+65
-8
lines changed

client/common/RouterTab.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import PropTypes from 'prop-types';
2-
import React from 'react';
1+
import React, { ReactNode } from 'react';
32
import { NavLink } from 'react-router-dom';
43

4+
export type TabProps = {
5+
children: ReactNode;
6+
to: string;
7+
};
58
/**
69
* Wraps the react-router `NavLink` with dashboard-header__tab styling.
710
*/
8-
const Tab = ({ children, to }) => (
11+
const Tab = ({ children, to }: TabProps) => (
912
<li className="dashboard-header__tab">
1013
<NavLink
1114
className="dashboard-header__tab__title"
@@ -17,9 +20,4 @@ const Tab = ({ children, to }) => (
1720
</li>
1821
);
1922

20-
Tab.propTypes = {
21-
children: PropTypes.string.isRequired,
22-
to: PropTypes.string.isRequired
23-
};
24-
2523
export default Tab;

package-lock.json

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
"@types/node": "^16.18.126",
131131
"@types/react": "^16.14.0",
132132
"@types/react-dom": "^16.9.25",
133+
"@types/react-router-dom": "^5.3.3",
133134
"@typescript-eslint/eslint-plugin": "^5.62.0",
134135
"@typescript-eslint/parser": "^5.62.0",
135136
"babel-core": "^7.0.0-bridge.0",

0 commit comments

Comments
 (0)