Skip to content

Commit aa33c1a

Browse files
committed
docs(middleware): update docs for customizing middleware
1 parent cba6f24 commit aa33c1a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,11 +822,14 @@ actions: {
822822
823823
### How can I customize each model's middlewares?
824824
825-
If you are using NextModel, you can customize each model's middlewares.
825+
You can customize each model's middlewares.
826826
827827
```typescript
828828
import { actionMiddlewares, Model } from 'react-model'
829-
import { delayMiddleware } from './middlewares'
829+
const delayMiddleware: Middleware = async (context, restMiddlewares) => {
830+
await timeout(1000, {})
831+
context.next(restMiddlewares)
832+
}
830833

831834
const nextCounterModel: NextModelType<CounterState, NextCounterActionParams> = {
832835
actions: {

0 commit comments

Comments
 (0)