indexiatech / re-notif

Redux & React based Notifications center.
http://indexiatech.github.io/re-notif
BSD 3-Clause "New" or "Revised" License
148 stars 45 forks source link

`notifSend()` returns a function not an action object. #29

Open jcheroske opened 8 years ago

jcheroske commented 8 years ago

The documentation shows the usage as:

dispatch(notifSend(message));

which seems to indicate that notifSend is returning an action object, but it actually returns a thunk. This is problematic for two reasons:

I feel that notifSend should return a simple action object, or another function should be added to the api the does just that.

jcheroske commented 8 years ago

Just learned you can't use backticks in the title. Good to know.

kylecesmat commented 8 years ago

Feel free to submit a PR for this! I agree that it shouldn't assume the application is using thunks.

mpint commented 8 years ago

@jcheroske, what is the workaround you found if you're using redux saga?

simutis commented 6 years ago

If you are not using thunks you can instead of:

dispatch(
   notifSend({
       message: 'Message success',
       kind: 'info',
       dismissAfter: 2000
   })
 );

do:

notifSend({
   message: 'Message success',
   kind: 'info',
   dismissAfter: 2000
})(dispatch);
janosh commented 6 years ago

@simutis Thanks, that worked great!