Cannot read property '0' of undefined

Такая проблема.

function getWidth(state, index) {
  return (state[index] || DEFAULT_WIDTH) + 'px'
}

Cannot read property '0' of undefined.

В state приходит undefined. Это файл table.template.

А вот файл table.

onMousedown(event) {
  if (shouldResize(event)) {
    this.resizeTable(event) // **-Вот тут мне eslint пишет, что Promise returned from resizeTable is ignored и предлагает мне сделать вот так `this.resizeTable(event).then(r => )`**
  } else if (isCell(event)) {
    const $target = $(event.target)
    if (event.shiftKey) {
      const $cells = matrix($target, this.selection.current)
        .map(id => this.$root.find(`[data-id="${id}"]`))
      this.selection.selectGroup($cells)
    } else {
      this.selectCell($target)
    }
  }
}

Возможно ли, что из-за resizeTbale(event), в файле table.template state - undefined?


Ответы (0 шт):