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
Copy file name to clipboardExpand all lines: dumi/docs/guide/advanced/index.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ As we learnt from section [Reactive Validation](/guide/validation#reactive-valid
63
63
64
64
### Transformed State
65
65
66
-
When we create input components based on UI inputs, these input components always provide their own business semantics which differs from the semantics of the original UI inputs. Which means, sometimes there's a gap between the business-value and the view-value for one component.
66
+
When we create input components based on UI inputs, these input components always provide their own business semantics which differ from the semantics of the original UI inputs. Which means, sometimes there's a gap between the business-value and the view-value for one component.
67
67
68
68
Let's take a component named `NumberInput` as example.
69
69
@@ -77,7 +77,7 @@ A typical number input is made with a normal text input to collect user input. S
77
77
const state =newFieldState('')
78
78
```
79
79
80
-
However, as implementation details, the `string`-type value, is not the value we would like the consumer of `NumberInput` to access. The component should behave as its name (`NumberInput`) suggests, collecting`number`-type value from user.
80
+
However, as implementation details, the `string`-type value, is not the value we would like the consumer of `NumberInput` to access. The component should behave as its name (`NumberInput`) suggests, to collect`number`-type value from user.
81
81
82
82
We need to transform the `string`-type value to number before we export it out. That's when `TransformedState` rescues:
83
83
@@ -101,7 +101,7 @@ In section [Conditional Validation](/guide/validation#conditional-validation), w
101
101
102
102
However, sometimes we may add more than one validators for one state. It will not be convenient to add the `if` logic in each validator.
103
103
104
-
Sometimes we face complex states, which composed with many child states. It's not possible to change child states' validators' logic for the parent state. `formstate-x` provides a method `disableWhen` to help with such cases.
104
+
Sometimes we face complex states, which are composed with child states. It's not proper to change validators' logic of child states when writing logic of parent states. `formstate-x` provides a method `disableWhen` to help with such cases.
Copy file name to clipboardExpand all lines: dumi/docs/guide/basic/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,4 +28,4 @@ As formstate-x is based on MobX, components who read state from formstate-x need
28
28
29
29
For convenience, we defined the field state (variable `state`) outside the component body. Actually, like any other MobX observable state, it's ok to be hold anywhere you like.
30
30
31
-
Now let's try some really cool thing. We will see how formstate-x provides powerful validating ability in section [Validation](/guide/validation).
31
+
Now let's try some real rocking thing. We will see how formstate-x provides powerful validating ability in section [Validation](/guide/validation).
### Comparison with [formstate](https://github.com/formstate/formstate)
59
59
60
60
formstate-x provides similar APIs with [formstate](https://github.com/formstate/formstate) because we like their simplicity. formstate has a very helpful document which we will recommend you to read. But there are some points of formstate that brought inconvenience to our development, and we got disagreement with formstate in related problems. That's why we build formstate-x:
61
61
62
-
1. formstate uses MobX but not embracing it, which constrained its ability (related issue: [#11](https://github.com/formstate/formstate/issues/11)). formstate-x leverages MobX's power substantially, so we can easily track all dependencies when do validation, including dynamic values or dynamic valdiators. That's also why realizing cross-field validation is extremly easy with formstat-x.
62
+
1. formstate uses MobX but not embracing it, which constrained its ability (related issue: [#11](https://github.com/formstate/formstate/issues/11)). formstate-x leverages MobX's power substantially, so we can easily track all dependencies when do validation, including dynamic values or dynamic valdiators. That's also why realizing cross-state validation is extremly easy with formstat-x.
63
63
2. formstate mixes validated, safe value with readable value (`$`), in some cases it's not suitable to use either `$` or `value`. formstate-x provides `value` as readable value, `$` as validated and safe value and `_value` for UI binding only.
64
64
3. formstate doesn't provide a good way to extract value from `FormState` ( related issues: [#25](https://github.com/formstate/formstate/issues/25)[#28](https://github.com/formstate/formstate/issues/28)). formstate-x provides `value` as `FormState`'s serialized value, with full type info.
65
65
4. formstate dosen't provide a good way to disable part of a `FormState`. `FormStateLazy` is like a hack and very different concept from `FieldState` & `FormState`. formstate-x provides `disableWhen` to let you realize conditional validation with a single method call.
0 commit comments