Skip to content

Commit 0c4aaca

Browse files
committed
improve README
Description: - add doc on how to dispatch external actions from connector
1 parent b226a62 commit 0c4aaca

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ export default class TodosConnector extends Connector {
128128
}
129129
```
130130

131+
#### External actions dispatching
132+
133+
If there is a need to dispatch an action of other Connector, i.e. from other namespace,
134+
that can be done using `#dispatch` and `.action` methods, like so:
135+
136+
```js
137+
// somewhere in TodosConnector.jsx
138+
139+
$createTodo(todo) {
140+
return post('/todos', { todo })
141+
.then(() => this.dispatch(ToolbarConnector.action('incrementTodosCount')));
142+
}
143+
```
144+
131145
### Connection
132146

133147
Connection is a very simple helper object that you should inherit from instead of

0 commit comments

Comments
 (0)