Skip to content

Commit 7c65551

Browse files
committed
Update README.md
1 parent 07cf142 commit 7c65551

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,25 @@ When in doubt, use the shorter option!
308308

309309
### Can I use this in production?
310310

311-
I wouldn't. Many use cases haven't been considered yet. If you find some use cases this lib can't handle yet, please file an issue.
311+
Yep. People already do that although I warned them! The API surface is minimal so migrating to 1.0 API when it comes out won't be difficult. Let us know about any issues.
312+
313+
### How do I do async?
314+
315+
There's already a built-in way of doing async action creators:
316+
317+
```js
318+
// Can also be async if you return a function
319+
export function incrementAsync() {
320+
return dispatch => {
321+
setTimeout(() => {
322+
// Yay! Can invoke sync or async actions with `dispatch`
323+
dispatch(increment());
324+
}, 1000);
325+
};
326+
}
327+
```
328+
329+
It's also easy to implement support for returning Promises or Observables with a custom middleware. [See an example of a custom Promise middleware.](https://github.com/gaearon/redux/issues/99#issuecomment-112212639)
312330

313331
### But there are switch statements!
314332

@@ -336,6 +354,8 @@ It's all just functions.
336354
Fancy stuff like generating stores from handler maps, or generating action creator constants, should be in userland.
337355
Redux has no opinion on how you do this in your project.
338356

357+
See also [this gist](https://gist.github.com/skevy/8a4ffc3cfdaf5fd68739) for an example implementation of action constant generation.
358+
339359
### What about `waitFor`?
340360

341361
I wrote a lot of vanilla Flux code and my only use case for it was to avoid emitting a change before a related Store consumes the action. This doesn't matter in Redux because the change is only emitted after *all* Stores have consumed the action.

0 commit comments

Comments
 (0)