2
私はwebpackとbabelを使用しています。何らかの理由でReactReduxが定義されていないのはなぜですか?
import React from 'react';
import ReactRedux from 'react-redux';
var Layout = React.createClass({
render(){
return (<div>Markup</div>);
}
});
function mapStateToProps(state, action) {
return state;
}
export default ReactRedux.connect(mapStateToProps)(Layout);
私はWebPACKのを実行すると、コンパイルした後、それがこのエラーで実行されます:Cannot read property 'connect' of undefined
私はこのようなファイルを持っています。なぜReactReduxオブジェクトを取得する際に失敗するのか不明です。私のWebPACKの設定は、このようなものです:
var compiler = webpack({
entry: "./dist/runner.js",
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: {
presets: ['es2015', 'react']
}
}
]
},
devtool: 'source-map',
output: {
filename: "public/dist/bundle.js"
}
});
や '反応-再来' からReactReduxとして、代わりに、 'インポート*は、' –
はい、私は直後ことに気づきました投稿する! :) –
ああありがとう! *: –