You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 23, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: docs/api/actions.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@
41
41
42
42
All model and field action creators can be imported via `import { actions } from 'react-redux-form'`. The action thunk creators require [redux-thunk middleware](https://github.com/gaearon/redux-thunk) to work, as they use thunks to get the current model state.
43
43
44
-
Also, all action creators are **trackable**, which means that the `model` argument can be a function, such as [`track()`](TODO), that returns a string model path given the store's state. For example:
44
+
Also, all action creators are **trackable**, which means that the `model` argument can be a function, such as [`track()`](../guides/tracking.md), that returns a string model path given the store's state. For example:
45
45
46
46
```jsx
47
47
import { track, actions } from'react-redux-form';
@@ -58,7 +58,7 @@ dispatch(actions.change(
58
58
59
59
Returns an action that, when handled by a `modelReducer`, changes the value of the `model` to the `value`.
60
60
61
-
When the change action is handled by a [`formReducer`](TODO), the field model's `.dirty` state is set to `true` and its corresponding `.pristine` state is set to `false`.
61
+
When the change action is handled by a [`formReducer`](./formReducer), the field model's `.dirty` state is set to `true` and its corresponding `.pristine` state is set to `false`.
62
62
63
63
### Arguments
64
64
-`model`_(String | Function)_: the model whose value will be changed
@@ -277,7 +277,7 @@ All model and field actions can be imported via `import { actions } from 'react-
277
277
278
278
<h2 id="actions-focus"></h2>
279
279
## `actions.focus(model)`
280
-
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.focus` state of the field model in the form to `true`.
280
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.focus` state of the field model in the form to `true`.
281
281
282
282
The "focus" state indicates that the field model is the currently focused field in the form.
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.focus` state to `false`. It also indicates that the field model has been `.touched`, and will set that state to `true`.
311
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.focus` state to `false`. It also indicates that the field model has been `.touched`, and will set that state to `true`.
312
312
313
313
A "blurred" field indicates that the field model control is not currently focused.
314
314
@@ -317,7 +317,7 @@ A "blurred" field indicates that the field model control is not currently focuse
317
317
318
318
<h2 id="actions-setPristine"></h2>
319
319
## `actions.setPristine(model)`
320
-
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.pristine` state of the field model in the form to `true`.
320
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.pristine` state of the field model in the form to `true`.
321
321
322
322
The "pristine" state indicates that the user has not interacted with this field model yet.
323
323
@@ -331,7 +331,7 @@ The "pristine" state indicates that the user has not interacted with this field
331
331
332
332
<h2 id="actions-setDirty"></h2>
333
333
## `actions.setDirty(model)`
334
-
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.pristine` state to `false`.
334
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.pristine` state to `false`.
335
335
336
336
A "dirty" field indicates that the model value has been changed, and is no longer pristine.
337
337
@@ -343,7 +343,7 @@ A "dirty" field indicates that the model value has been changed, and is no longe
343
343
344
344
<h2 id="actions-setPending"></h2>
345
345
## `actions.setPending(model, [pending])`
346
-
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.pending` state of the field model in the form to `true`. It simultaneously sets the `.submitted` state to `false`.
346
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.pending` state of the field model in the form to `true`. It simultaneously sets the `.submitted` state to `false`.
347
347
348
348
### Arguments
349
349
- `model` _(String | Function)_: the model indicated as pending
@@ -355,7 +355,7 @@ Returns an action that, when handled by a [`formReducer`](TODO), changes the `.p
355
355
356
356
<h2 id="actions-setTouched"></h2>
357
357
## `actions.setTouched(model)`
358
-
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.touched` state of the field model in the form to `true`. It simultaneously sets the `.untouched` state to `false`.
358
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.touched` state of the field model in the form to `true`. It simultaneously sets the `.untouched` state to `false`.
359
359
360
360
The "touched" state indicates that this model has been interacted with.
361
361
@@ -368,7 +368,7 @@ The "touched" state indicates that this model has been interacted with.
368
368
369
369
<h2 id="actions-setUntouched"></h2>
370
370
## `actions.setUntouched(model)`
371
-
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.touched` state to `false`.
371
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.touched` state to `false`.
372
372
373
373
An "untouched" field indicates that this model has not been interacted with yet.
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.submitted` state of the field model in the form to `submitted` (`true` or `false`). It simultaneously sets the `.pending` state to the inverse of`submitted`.
462
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.submitted` state of the field model in the form to `submitted` (`true` or `false`). It simultaneously sets the `.pending` state to the inverse of`submitted`.
463
463
464
464
The "submitted" state indicates that this model has been "sent off," or an action has been completed for the model.
465
465
@@ -491,7 +491,7 @@ export default function submitUser(data) {
491
491
492
492
<h2 id="actions-setSubmitFailed"></h2>
493
493
## `actions.setSubmitFailed(model)`
494
-
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.submitFailed` state of the field model in the form to `true`. It simultaneously sets the `.pending` state to `false`, and the `.retouched` state to `false`.
494
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.submitFailed` state of the field model in the form to `true`. It simultaneously sets the `.pending` state to `false`, and the `.retouched` state to `false`.
495
495
496
496
### Arguments
497
497
-`model`_(String|Function)_: the model indicated as having failed a submit
@@ -505,7 +505,7 @@ Returns an action that, when handled by a [`formReducer`](TODO), changes the `.s
505
505
506
506
<h2 id="actions-setInitial"></h2>
507
507
## `actions.setInitial(model)`
508
-
Returns an action that, when handled by a [`formReducer`](TODO), changes the state of the field model in the form to its initial state.
508
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the state of the field model in the form to its initial state.
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.valid` state of the field model in the form to `true` or `false`, based on the `validity` (see below). It will also set the `.validity` state of the field model to the `validity`.
537
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.valid` state of the field model in the form to `true` or `false`, based on the `validity` (see below). It will also set the `.validity` state of the field model to the `validity`.
538
538
539
539
It also sets the `.errors` on the field model to the inverse of the `validity`.
Returns an action that, when handled by a [`formReducer`](TODO), sets the `.validity` state of each sub-model key in the `fieldsValidity` object to that key's value.
584
+
Returns an action that, when handled by a [`formReducer`](./formReducer), sets the `.validity` state of each sub-model key in the `fieldsValidity` object to that key's value.
585
585
586
586
It simultaneously sets the `.errors` on each sub-model to the inverse of its validity.
Returns an action that, when handled by a [`formReducer`](TODO), changes the `.valid` state of the field model in the form to `true` or `false`, based on the `errors` (see below). It will also set the `.errors` state of the field model to the `errors`.
657
+
Returns an action that, when handled by a [`formReducer`](./formReducer), changes the `.valid` state of the field model in the form to `true` or `false`, based on the `errors` (see below). It will also set the `.errors` state of the field model to the `errors`.
658
658
659
659
It simultaneously sets the `.validity` on the field model to the inverse of the `errors`.
Returns an action that, when handled by a [`formReducer`](TODO), sets the `.errors` state of each sub-model key in the `fieldsErrors` object to that key's value.
708
+
Returns an action that, when handled by a [`formReducer`](./formReducer), sets the `.errors` state of each sub-model key in the `fieldsErrors` object to that key's value.
709
709
710
710
It simultaneously sets the `.validity` on each sub-model to the inverse of its errors.
0 commit comments