Redux: Put action after state with default value in reducer will cause jshint to complain

Created on 16 Feb 2016  路  1Comment  路  Source: reduxjs/redux

JSHint will report:
Regular parameters should not come after default parameters. W138

Most helpful comment

Well, we don鈥檛 agree with this particular rule. You can either disable it, or not use optional parameters and write something like

function counter(state, action) {
  if (typeof state === 'undefined') {
    return 0
  }

  switch (action.type) {
    // ...
  }
}

>All comments

Well, we don鈥檛 agree with this particular rule. You can either disable it, or not use optional parameters and write something like

function counter(state, action) {
  if (typeof state === 'undefined') {
    return 0
  }

  switch (action.type) {
    // ...
  }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

benoneal picture benoneal  路  3Comments

vraa picture vraa  路  3Comments

ramakay picture ramakay  路  3Comments

olalonde picture olalonde  路  3Comments

timdorr picture timdorr  路  3Comments