-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Proposal: formValues() HOC decorator that works inside a form component #2996
Comments
Alright, I took a stab at implementing it. It's using |
Merged #3011. Will comment again when released. |
Fix published in |
I am sure I'm using the feature incorrectly. Instead of reading from Redux directly I thought I could use |
I wanted to access forms values within the component. I know I can pass it down by using connect but though this may be cleaner. |
No, what you did there is create a component named Values that gives
`email` and `password` as props to the Auth component
…On Thu, 15 Jun 2017, 11:44 AM jasan-s, ***@***.***> wrote:
I wanted to access forms values within the component. I know I can pass it
down by using connect but though this may be cleaner.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2996 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADWll-Z-lcZ6_wD7pBs5JFmd_ydBoA7ks5sEPzzgaJpZM4Nr-dH>
.
|
@wmertens so, what is the recommended way to accesses the form field values within the same form component? should i add something to the main export
|
Exactly this. Use <Value/> instead of <Auth/> and you will have the current
field values as props.
…On Thu, Jun 15, 2017 at 12:16 PM jasan-s ***@***.***> wrote:
@wmertens <https://github.com/wmertens> so, what is the recommended way
to accesses the form field values within the same form component?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2996 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADWlhD4ZQE00m48zzfDqBiEx9nBbr0Kks5sEQRqgaJpZM4Nr-dH>
.
|
Note that @formValues simply creates the @connect function that you need to
get the values
On Thu, Jun 15, 2017 at 12:17 PM Wout Mertens <wout.mertens@gmail.com>
wrote:
… Exactly this. Use <Value/> instead of <Auth/> and you will have the
current field values as props.
On Thu, Jun 15, 2017 at 12:16 PM jasan-s ***@***.***> wrote:
> @wmertens <https://github.com/wmertens> so, what is the recommended way
> to accesses the form field values within the same form component?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#2996 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AADWlhD4ZQE00m48zzfDqBiEx9nBbr0Kks5sEQRqgaJpZM4Nr-dH>
> .
>
|
@erikras I face some strange behaviour with formValues: values lagging behind the state at the time of reading. getValues retun { flag: false } when it actually true in the state. They syncs only on next mapStateToProps calculation, which might be performed only at next user interaction. So formValuesSelector works for me, but formValues does not =( |
@gleb-lobastov can you share the code where you are using it? The |
@wmertens finally I reproduce the issue: And root of problem was in my react-redux version: 4.4.5 |
@gleb-lobastov wow, that's surprising! Good that you were able to fix it! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
From discussion on #2852 with @wmertens. The problem being solved is that
formValueSelector()
cannot be used in a reusable way inside a<FormSection>
because it doesn't know what the prefix defined in the<FormSection>
is. General API syntax would look like:There might also be an alternative syntax where, if your keys and values were all going to be the same, rather than pass...
...you could just pass a list of strings. e.g.
The text was updated successfully, but these errors were encountered: