source: imaps-frontend/node_modules/react-use/esm/factory/createRouter.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 842 bytes
Line 
1import React from 'react';
2var createRouter = function () {
3 var context = React.createContext({
4 route: '',
5 });
6 // not sure if this supposed to be unused, ignoring ts error for now
7 // @ts-ignore
8 var Router = function (props) {
9 var route = props.route, fullRoute = props.fullRoute, parent = props.parent, children = props.children;
10 if (process.env.NODE_ENV !== 'production') {
11 if (typeof route !== 'string') {
12 throw new TypeError('Router route must be a string.');
13 }
14 }
15 return React.createElement(context.Provider, {
16 value: {
17 fullRoute: fullRoute || route,
18 route: route,
19 parent: parent,
20 },
21 children: children,
22 });
23 };
24};
25export default createRouter;
Note: See TracBrowser for help on using the repository browser.