Skip to content

Commit 9a02d2e

Browse files
committed
fix: rr6 es5 build for jest support
1 parent c0a0683 commit 9a02d2e

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ build
44
dist
55
public
66
scripts
7+
rr6

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-first-history",
3-
"version": "5.0.4",
3+
"version": "5.0.5",
44
"description": "Redux First History - Redux history binding support react-router - @reach/router - wouter",
55
"main": "build/es5/index.js",
66
"module": "build/es6/index.js",

rr6/index.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1+
"use strict";
2+
var __importDefault = (this && this.__importDefault) || function (mod) {
3+
return (mod && mod.__esModule) ? mod : { "default": mod };
4+
};
5+
Object.defineProperty(exports, "__esModule", { value: true });
6+
exports.HistoryRouter = void 0;
17
/* eslint-disable react/no-children-prop */
2-
import React from 'react';
3-
import { Router } from 'react-router';
4-
5-
export function HistoryRouter({ basename, children, history }) {
6-
const [state, setState] = React.useState({
8+
var react_1 = __importDefault(require("react"));
9+
var react_router_1 = require("react-router");
10+
function HistoryRouter(_a) {
11+
var basename = _a.basename, children = _a.children, history = _a.history;
12+
var _b = react_1.default.useState({
713
action: history.action,
814
location: history.location,
9-
});
10-
React.useLayoutEffect(() => history.listen(setState), [history]);
11-
return React.createElement(Router, {
12-
basename,
13-
children,
15+
}), state = _b[0], setState = _b[1];
16+
react_1.default.useLayoutEffect(function () { return history.listen(setState); }, [history]);
17+
return react_1.default.createElement(react_router_1.Router, {
18+
basename: basename,
19+
children: children,
1420
location: state.location,
1521
navigationType: state.action,
1622
navigator: history,
1723
});
18-
}
24+
}
25+
exports.HistoryRouter = HistoryRouter;

0 commit comments

Comments
 (0)