main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1004 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | var tslib_1 = require("tslib");
|
---|
4 | var react_1 = tslib_1.__importDefault(require("react"));
|
---|
5 | var createRouter = function () {
|
---|
6 | var context = react_1.default.createContext({
|
---|
7 | route: '',
|
---|
8 | });
|
---|
9 | // not sure if this supposed to be unused, ignoring ts error for now
|
---|
10 | // @ts-ignore
|
---|
11 | var Router = function (props) {
|
---|
12 | var route = props.route, fullRoute = props.fullRoute, parent = props.parent, children = props.children;
|
---|
13 | if (process.env.NODE_ENV !== 'production') {
|
---|
14 | if (typeof route !== 'string') {
|
---|
15 | throw new TypeError('Router route must be a string.');
|
---|
16 | }
|
---|
17 | }
|
---|
18 | return react_1.default.createElement(context.Provider, {
|
---|
19 | value: {
|
---|
20 | fullRoute: fullRoute || route,
|
---|
21 | route: route,
|
---|
22 | parent: parent,
|
---|
23 | },
|
---|
24 | children: children,
|
---|
25 | });
|
---|
26 | };
|
---|
27 | };
|
---|
28 | exports.default = createRouter;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.