@umijs/renderer-react 4.0.0-beta.15 → 4.0.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { History } from 'history';
1
2
  import { IRouteComponents, IRoutesById } from './types';
2
3
  export declare function renderClient(opts: {
3
4
  rootElement?: HTMLElement;
@@ -5,4 +6,5 @@ export declare function renderClient(opts: {
5
6
  routeComponents: IRouteComponents;
6
7
  pluginManager: any;
7
8
  basename?: string;
9
+ history: History;
8
10
  }): void;
package/dist/browser.js CHANGED
@@ -1,16 +1,10 @@
1
- // @ts-ignore
2
- import { createBrowserHistory } from 'history';
3
1
  import React from 'react';
4
2
  import ReactDOM from 'react-dom';
5
3
  import { Router, useRoutes } from 'react-router-dom';
6
4
  import { AppContext, useAppData } from './appContext';
7
5
  import { createClientRoutes } from './routes';
8
6
  function BrowserRoutes(props) {
9
- const historyRef = React.useRef();
10
- if (historyRef.current == null) {
11
- historyRef.current = createBrowserHistory({ window });
12
- }
13
- const history = historyRef.current;
7
+ const { history } = props;
14
8
  const [state, setState] = React.useState({
15
9
  action: history.action,
16
10
  location: history.location,
@@ -41,7 +35,7 @@ export function renderClient(opts) {
41
35
  routesById: opts.routes,
42
36
  routeComponents: opts.routeComponents,
43
37
  });
44
- let rootContainer = (React.createElement(BrowserRoutes, { basename: basename, pluginManager: opts.pluginManager, routes: opts.routes, clientRoutes: clientRoutes },
38
+ let rootContainer = (React.createElement(BrowserRoutes, { basename: basename, pluginManager: opts.pluginManager, routes: opts.routes, clientRoutes: clientRoutes, history: opts.history },
45
39
  React.createElement(Routes, null)));
46
40
  for (const key of [
47
41
  // Lowest to the highest priority
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { createBrowserHistory, createHashHistory, createMemoryHistory, History, } from 'history';
1
2
  export { createSearchParams, Link, matchPath, matchRoutes, NavLink, Outlet, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes, useSearchParams, } from 'react-router-dom';
2
3
  export { useAppData } from './appContext';
3
4
  export { renderClient } from './browser';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { createBrowserHistory, createHashHistory, createMemoryHistory, } from 'history';
1
2
  export { createSearchParams, Link, matchPath, matchRoutes, NavLink, Outlet, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes, useSearchParams, } from 'react-router-dom';
2
3
  export { useAppData } from './appContext';
3
4
  export { renderClient } from './browser';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/renderer-react",
3
- "version": "4.0.0-beta.15",
3
+ "version": "4.0.0-beta.16",
4
4
  "description": "@umijs/renderer-react",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/renderer-react#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -26,8 +26,8 @@
26
26
  "react-router-dom": "6.1.1"
27
27
  },
28
28
  "devDependencies": {
29
- "react": "18.0.0-rc.0",
30
- "react-dom": "18.0.0-rc.0"
29
+ "react": "17.0.2",
30
+ "react-dom": "17.0.2"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": ">=16.8",