redux-async-connect icon indicating copy to clipboard operation
redux-async-connect copied to clipboard

Update the readme and API ?

Open leozdgao opened this issue 9 years ago • 1 comments
trafficstars

It seems the example in readme.md is not working in v1.0.0-rc2, it's very confusing and I don't know how to use this in the right way. :cry:

Uncaught TypeError: asyncItems.map is not a function

function wrapWithDispatch(asyncItems) {  
  return asyncItems.map(function (item) {
  ...

It seems it should be an array? But in the example:

@asyncConnect({
  lunch: (params, helpers) => Promise.resolve({id: 1, name: 'Borsch'})
})

I don't know how to do next...

leozdgao avatar Mar 03 '16 04:03 leozdgao

I've just stumbled upon this as well... It seems that with the new API the example should be rewritten like this:

@asyncConnect([{
  key: 'lunch',
  promise: (params, helpers) => Promise.resolve({id: 1, name: 'Borsch'})
}])

In short - instead of an object, you should pass an array of objects, each having 2 fields - 'key' and 'promise'.

jac3km4 avatar Mar 07 '16 03:03 jac3km4