LoginSignup
3
4

More than 5 years have passed since last update.

Redux: webpack+babelでSpread Operatorを利用できるようにする

Posted at

Spread Operator を使えるようにする

コマンドラインで

$ yarn add babel-preset-stage-2

そしてwebpack.config.jsのpresetsに次にようにstage-2を加える。

webpack.config.js
    ...
    module: {
      loaders: [{
        exclude: /node_modules/,
        loader: 'babel-loader',
        query: {
          presets: ['react', 'es2015', 'stage-2'],
        },
      }],
    },
    ...

これでreduxのreducerのreturnを書く時などにSpread Operatorを使って楽になれる。

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4