Я попытался интегрировать MobX в свой проект Electron + React.js и добавил компонент с аннотацией @observer, как в документации:
@observer
class TodoListView extends Component {
К сожалению, я получаю ошибку:
... / components / TodoListView.jsx: неожиданный токен (6: 0)
Вот так выглядит мой package.json:
{
"name": "electron1",
"productName": "electron1",
"version": "1.0.0",
"description": "My Electron application description",
"main": "src/index.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "eslint --cache --color --ext .jsx,.js src"
},
"keywords": [],
"author": "steph",
"license": "MIT",
"config": {
"forge": {
"make_targets": {
"win32": [
"squirrel"
],
"darwin": [
"zip"
],
"linux": [
"deb",
"rpm"
]
},
"electronPackagerConfig": {
"packageManager": "yarn"
},
"electronWinstallerConfig": {
"name": "electron1"
},
"electronInstallerDebian": {},
"electronInstallerRedhat": {},
"github_repository": {
"owner": "",
"name": ""
},
"windowsStoreConfig": {
"packageName": "",
"name": "electron1"
}
}
},
"dependencies": {
"electron-compile": "^6.4.3",
"electron-devtools-installer": "^2.1.0",
"electron-squirrel-startup": "^1.0.0",
"express": "^4.12.3",
"mobx": "^5.6.0",
"mobx-react": "^5.4.2",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-hot-loader": "^3.0.0-beta.6",
"ws": "^0.7.1"
},
"devDependencies": {
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"electron-forge": "^5.2.3",
"electron-prebuilt-compile": "3.0.10",
"eslint": "^3",
"eslint-config-airbnb": "^15",
"eslint-plugin-import": "^2",
"eslint-plugin-jsx-a11y": "^5",
"eslint-plugin-react": "^7"
}
}
Первоначально я запустил проект с помощью Electronic Forge.Я новичок в реакции и не имею большого опыта работы с js - любая помощь высоко ценится!