drcmda / react-contextual

🚀 react-contextual is a small (less than 1KB) helper around React 16s new context api
MIT License
642 stars 23 forks source link

feat: access state via this in actions #32

Closed laggingreflex closed 5 years ago

laggingreflex commented 5 years ago
createStore({
  files: ['a'],
  add (file) {
    return { files: [...this.files, file] }
                        ^^^^ access state in actions via `this`
  }
});
laggingreflex commented 5 years ago

Nevermind, didn't realize state is already accessible by just passing a function.