意外的標記我有一個組件:ReactJS在組件
import React from 'react';
export default class LeftNavigation extends React.Component {
static contextTypes = {
getStore: React.PropTypes.func.isRequired
};
render() {
return (
<div>
Left
</div>
)
}
}
但是當我嘗試捆綁(與JSPM)我得到:
SyntaxError: file:///C:/wamp/www/rentapp/public/src/components/add-property/LeftNavigation.js: Unexpected token (5:24)
export default class LeftNavigation extends React.Component {
static contextTypes = {
getStore: React.PropTypes.func.isRequired
}
};
我該如何解決這個問題?
這裏是我的package.json
文件:
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch"
},
"devDependencies": {
"bootstrap-sass": "^3.0.0",
"gulp": "^3.9.1",
"jspm": "^0.16.34",
"laravel-elixir": "^5.0.0"
},
"jspm": {
"directories": {
"baseURL": "public"
},
"dependencies": {
"body-parser": "npm:[email protected]^1.15.0",
"express": "npm:[email protected]^4.13.4",
"fluxible": "npm:[email protected]^1.1.0",
"fluxible-addons-react": "npm:[email protected]^0.2.8",
"jsx": "github:floatdrop/[email protected]^1.2.1",
"react": "npm:[email protected]^15.0.2",
"react-dom": "npm:[email protected]^15.0.2",
"react-router": "npm:[email protected]^2.4.0"
},
"devDependencies": {
"babel": "npm:[email protected]^6.8.0",
"babel-runtime": "npm:[email protected]^5.8.24",
"core-js": "npm:[email protected]^1.1.4"
}
},
"dependencies": {
"babel": "^6.5.2",
"body-parser": "^1.15.0",
"express": "^4.13.4",
"fluxible": "^1.1.0",
"react": "^15.0.2"
},
"name": "rentapp",
"description": "[![Build Status](https://travis-ci.org/laravel/framework.svg)](https://travis-ci.org/laravel/framework) [![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.svg)](https://packagist.org/packages/laravel/framework) [![Latest Stable Version](https://poser.pugx.org/laravel/framework/v/stable.svg)](https://packagist.org/packages/laravel/framework) [![Latest Unstable Version](https://poser.pugx.org/laravel/framework/v/unstable.svg)](https://packagist.org/packages/laravel/framework) [![License](https://poser.pugx.org/laravel/framework/license.svg)](https://packagist.org/packages/laravel/framework)",
"version": "1.0.0",
"main": "gulpfile.js",
"directories": {
"test": "tests"
},
"keywords": [],
"author": "",
"license": "ISC",
}
你有通天transpiling?看起來你可能只需要使用var contextTypes = {...' – Alex
你粘貼的代碼是缺少'};' –
是的,但是因爲我開始嘗試創建一個需要babel的節點服務器(我放棄了這現在)我開始得到這個錯誤。 – imperium2335