我尝试按照在fluxible connectToStores示例中使用装饰器模式的说明进行操作
http://fluxible.io/addons/connectToStores.html
@connectToStores([FooStore, BarStore], (context, props) => ({
foo: context.getStore(FooStore).getFoo(),
bar: context.getStore(BarStore).getBar()
}))
class Component extends React.Component {
render() {
return <div/>;
}
}
export default Component;
但是,我在@符号上遇到语法错误。我是否必须首先配置或加载某些内容才能在我的应用程序应用程序中识别装饰器模式?
我已经尝试了以下webpack.config.js来在fluxible模板上启用stage 0支持但是我收到一条错误,说当有多个加载器时我无法声明查询
webpack.config.js
var webpack = require('webpack');
var path = require('path');
var webpackConfig = {
resolve: {
extensions: ['', '.js', '.jsx']
},
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./client.js'
],
output: {
path: path.resolve('./build/js'),
publicPath: '/public/js/',
filename: 'main.js'
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loaders: [
require.resolve('react-hot-loader'),
require.resolve('babel-loader')
],
query: {stage: 0}
},
{ test: /\.json$/, loader: 'json-loader'}
]
},
node: {
setImmediate: false
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
})
],
devtool: 'eval'
};
module.exports = webpackConfig;