Skip to content

Commit eb243cc

Browse files
icd2k3jschrader-nr
andauthored
chore: remove react-router-dom as a dependency (#103)
Co-authored-by: Justin Schrader <[email protected]>
1 parent fe8ab74 commit eb243cc

File tree

5 files changed

+7
-25
lines changed

5 files changed

+7
-25
lines changed

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-breadcrumbs-hoc",
3-
"version": "3.2.7",
3+
"version": "3.2.8",
44
"description": "small, flexible, higher order component for rendering breadcrumbs with react-router 4.x",
55
"repository": "icd2k3/react-router-breadcrumbs-hoc",
66
"main": "dist/cjs/index.js",
@@ -28,8 +28,7 @@
2828
"license": "MIT",
2929
"peerDependencies": {
3030
"react": ">=16.8",
31-
"react-router": ">=4",
32-
"react-router-dom": ">=4"
31+
"react-router": ">=4"
3332
},
3433
"dependencies": {},
3534
"devDependencies": {
@@ -66,7 +65,6 @@
6665
"react": "16.13.0",
6766
"react-dom": "16.13.0",
6867
"react-router": "^5.1.2",
69-
"react-router-dom": "^5.1.2",
7068
"rollup": "^2.1.0",
7169
"rollup-plugin-babel": "^4.4.0",
7270
"rollup-plugin-uglify": "^6.0.2",

src/index.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import React from 'react';
55
import PropTypes from 'prop-types';
66
import { mount } from 'enzyme';
77
import { MemoryRouter as Router } from 'react-router';
8-
import { NavLink } from 'react-router-dom';
98
import withBreadcrumbs, { getBreadcrumbs } from './index.tsx';
109

1110
// imports to test compiled builds
@@ -32,7 +31,7 @@ const components = {
3231
</h1>
3332
),
3433
BreadcrumbMatchTest: ({ match }) => <span>{match.params.number}</span>,
35-
BreadcrumbNavLinkTest: ({ match }) => <NavLink to={match.url}>Link</NavLink>,
34+
BreadcrumbNavLinkTest: ({ match }) => <a to={match.url}>Link</a>,
3635
BreadcrumbLocationTest: ({ location: { state: { isLocationTest } } }) => (
3736
<span>
3837
{isLocationTest ? 'pass' : 'fail'}
@@ -151,7 +150,7 @@ describe('react-router-breadcrumbs-hoc', () => {
151150
];
152151
const { breadcrumbs, wrapper } = render({ pathname: '/1/2/3/4', routes });
153152
expect(breadcrumbs).toBe('Home / One / TWO / 3 / Link');
154-
expect(wrapper.find(NavLink).props().to).toBe('/1/2/3/4');
153+
expect(wrapper.find('a').props().to).toBe('/1/2/3/4');
155154
});
156155
});
157156

src/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
*/
2020

2121
import React, { createElement } from 'react';
22-
import { matchPath, withRouter } from 'react-router';
23-
import { useLocation } from 'react-router-dom';
22+
import { useLocation, matchPath, withRouter } from 'react-router';
2423

2524
// eslint-disable-next-line import/extensions, import/no-unresolved, no-unused-vars
2625
import * as types from '../types/react-router-breadcrumbs-hoc/index';

types/react-router-breadcrumbs-hoc/react-router-breadcrumbs-hoc-tests.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from "react";
22
import { RouteComponentProps } from "react-router";
3-
import { NavLink } from "react-router-dom";
43
import withBreadcrumbs, {
54
BreadcrumbsRoute,
65
BreadcrumbsProps,
@@ -30,7 +29,7 @@ const Breadcrumbs = ({ breadcrumbs }: InjectedProps) => (
3029
<div>
3130
{breadcrumbs.map(({ breadcrumb, match }: BreadcrumbsProps, index: number) => (
3231
<span key={match.url}>
33-
<NavLink to={match.url}>{breadcrumb}</NavLink>
32+
<a href={match.url}>{breadcrumb}</a>
3433
{index < breadcrumbs.length - 1 && <i> / </i>}
3534
</span>
3635
))}

yarn.lock

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5203,20 +5203,7 @@ react-is@^16.12.0, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-i
52035203
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.0.tgz#0f37c3613c34fe6b37cd7f763a0d6293ab15c527"
52045204
integrity sha512-GFMtL0vHkiBv9HluwNZTggSn/sCyEt9n02aM0dSAjGGyqyNlAyftYm4phPxdvCigG15JreC5biwxCgTAJZ7yAA==
52055205

5206-
react-router-dom@^5.1.2:
5207-
version "5.1.2"
5208-
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.1.2.tgz#06701b834352f44d37fbb6311f870f84c76b9c18"
5209-
integrity sha512-7BPHAaIwWpZS074UKaw1FjVdZBSVWEk8IuDXdB+OkLb8vd/WRQIpA4ag9WQk61aEfQs47wHyjWUoUGGZxpQXew==
5210-
dependencies:
5211-
"@babel/runtime" "^7.1.2"
5212-
history "^4.9.0"
5213-
loose-envify "^1.3.1"
5214-
prop-types "^15.6.2"
5215-
react-router "5.1.2"
5216-
tiny-invariant "^1.0.2"
5217-
tiny-warning "^1.0.0"
5218-
5219-
[email protected], react-router@^5.1.2:
5206+
react-router@^5.1.2:
52205207
version "5.1.2"
52215208
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.1.2.tgz#6ea51d789cb36a6be1ba5f7c0d48dd9e817d3418"
52225209
integrity sha512-yjEuMFy1ONK246B+rsa0cUam5OeAQ8pyclRDgpxuSCrAlJ1qN9uZ5IgyKC7gQg0w8OM50NXHEegPh/ks9YuR2A==

0 commit comments

Comments
 (0)