Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 467f4c9

Browse files
committed
Updating FAQs to include info on getting the fully resolved model string. Fixes #751
1 parent b98fd89 commit 467f4c9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/guides/faqs.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,22 @@ Instead, use the native `onInvalid` handler to prevent the native HTML5 validati
184184
/>
185185
```
186186

187+
### With partial models, how do I get the fully resolved model string?
188+
189+
You can always grab the fully resolved model string from the `<Control>`-specific props through `mapProps`:
190+
191+
```jsx
192+
<Control.text
193+
194+
model=".firstName"
195+
mapProps={{ model: ({ model }) => model }}
196+
/>
197+
// model will be the fully resolved model,
198+
// e.g., "user.firstName"
199+
```
200+
201+
This is especially useful for custom components, such as a checkbox wrapped in a label, that need the fully resolved model name.
202+
187203
### Other Questions and Answers
188204
- https://github.com/davidkpiano/react-redux-form/issues/675#issuecomment-281164930
189205
{% endraw %}

0 commit comments

Comments
 (0)