尝试使用TypeScript跟踪此演练React Integrating Routing to Material UI’s Left Nav (or Other Components)时获取/usr/bin/python2.7 /usr/local/google_appengine/dev_appserver.py --host 0.0.0.0 --log_level=debug dispatch.yaml main/main.yaml buildin/buildin.yaml
WARNING 2016-08-16 16:11:18,474 application_configuration.py:786] Hostname routing is not supported by the development server. The following dispatch entries will not match any requests:
<DispatchEntry
url=buildin-dot-myapp.appspot.com/*
service=None
module=buildin
>
INFO 2016-08-16 16:11:18,506 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO 2016-08-16 16:11:18,716 sdk_update_checker.py:257] The SDK is up to date.
INFO 2016-08-16 16:11:18,884 api_server.py:205] Starting API server at: http://localhost:36398
INFO 2016-08-16 16:11:18,885 dispatcher.py:185] Starting dispatcher running at: http://0.0.0.0:8080
INFO 2016-08-16 16:11:18,890 dispatcher.py:197] Starting module "default" running at: http://0.0.0.0:8081
INFO 2016-08-16 16:11:18,893 dispatcher.py:197] Starting module "buildin" running at: http://0.0.0.0:8082
INFO 2016-08-16 16:11:18,897 admin_server.py:116] Starting admin server at: http://localhost:8000
。
我的代码:
JSX element type 'Route' does not have any construct or call signatures
导致TypeScript编译器使用上述错误消息对Route和IndexRount导入进行投诉。
这是我的导入语句(包括我自己的es模块)。请注意从const Routes = (
<Route path="/" handler={Main}>
<IndexRoute handler={ConnectionModule} />
</Route>
);
向中间导入。
react-router
我正在使用这些版本的relavant npm包(来自package.json)
import { AppBar, Drawer, FontIcon, List, ListItem, MakeSelectable, TouchTapEvent } from 'material-ui';
import { deepOrange500 } from 'material-ui/styles/colors';
import { getMuiTheme, MuiThemeProvider } from 'material-ui/styles';
import * as React from 'react';
import { Component } from 'react';
import Router from 'react-router';
import { Route, IndexRoute, Redirect, Link } from 'react-router';
import MainState from './MainState';
import ConsoleModule from './ConsoleModule';
import ConnectionModule, { ConnectionModuleState } from './containers/ConnectionModule';
相关链接:
答案 0 :(得分:0)
问题在于react-router定义文件,你需要编辑它:为名为“React”的新命名空间更改名为“_React”的旧全局命名空间。
这只发生在使用npm类型的安装。