Skip to content

Commit de2aad4

Browse files
stern-shawnmarkerikson
authored andcommitted
Update usage-guide.md to reflect updates (#210)
* Update usage-guide.md to reflect updates I think the `createAction` function has since been updated to support `prepare` for adding attributes like `meta` to an action. Updating documentation so users don't get discouraged and think they can't use `meta` along with `redux-starter-kit`. * Update usage-guide.md
1 parent 9170e43 commit de2aad4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/usage/usage-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ addTodo({ text: 'Buy milk' })
288288
// {type : "ADD_TODO", payload : {text : "Buy milk"}})
289289
```
290290

291-
Currently, `createAction` does not let you customize how the `payload` field is defined. You need to pass the entire `payload` you want as the one argument to the action creator. This could be a simple value, or an object full of data. (We may eventually add the ability for `createAction` to accept an argument for a callback that customizes the payload, or allows adding other fields like `meta` to the action.)
291+
`createAction` also accepts a "prepare callback" argument, which allows you to customize the resulting `payload` field and optionally add a `meta` field. See the [`createAction` API reference](https://redux-starter-kit.js.org/api/createaction#using-prepare-callbacks-to-customize-action-contents) for details on defining action creators with a prepare callback.
292292

293293
### Using Action Creators as Action Types
294294

0 commit comments

Comments
 (0)