Recompose: call handler from another?

Created on 27 May 2017  路  5Comments  路  Source: acdlite/recompose

How to call handler from another?
something like this

  withHandlers({
    handlerOne: props => value =>
      console.log(value)
    handlerTwo: props => () => {
      handlerOne('Hello, World')
    },

Most helpful comment

@code-by You can use two withHandlers. Props from prev with new handler will be passed to the next one.

All 5 comments

@code-by You can use two withHandlers. Props from prev with new handler will be passed to the next one.

if one run my example there will be error
Uncaught ReferenceError: handlerOne is not defined

Call it from props. Of course there's nothing in the scope. It's just properties of the object. Not magic.

I also created a PR https://github.com/acdlite/recompose/pull/401 not sure it will be merged

I'll close this, if anyone want to proceed please write at #401

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nemocurcic picture nemocurcic  路  3Comments

jethrolarson picture jethrolarson  路  4Comments

jeron-diovis picture jeron-diovis  路  4Comments

istarkov picture istarkov  路  3Comments

xialvjun picture xialvjun  路  4Comments