Decorated form doesn't receive documented values instance prop
See original GitHub issueAccording to: http://redux-form.com/6.2.0/docs/api/ReduxForm.md/
… in the section labeled Instance API the decorated component should have access to a values
property, which should be
The current values of all the fields in the form.
But, no matter what I do, I can’t get the documented values
property, either in my own code, or by pulling down the simple example and modifying it.
A simple example is conditionally rendering something in the form based on the current value, which seems like exactly what the documented values
object would be ideal for.
import React from 'react'
import { Field, reduxForm } from 'redux-form'
const MyForm = ({ handleSubmit, values }) => (
<form onSubmit={handleSubmit}>
<div>
<Field name="name" component="input" type="text"/>
{values.name === 'Fred' && <b>Hi Fred!</b>} // <-- error! `values` undefined
</div>
</form>
);
export default reduxForm({ form: 'myForm' })(MyForm);
Or am I totally mis-understanding the documentation?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Decorated form doesn't receive documented values instance ...
The current values of all the fields in the form. But, no matter what I do, I can't get the documented values property,...
Read more >@prop | typegoose
Any Property that does not have @prop on it will not be in the Schema, because typegoose's current approach is that the keys...
Read more >Documentation - Decorators - TypeScript
A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators use...
Read more >Model validation in ASP.NET Core MVC | Microsoft Learn
The IsValid method accepts an object named value, which is the input to be validated. An overload also accepts a ValidationContext object, which ......
Read more >Properties - Stencil.js
Properties. Props are custom attributes/properties exposed publicly on an HTML element. They allow developers to pass data to a component to render or ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jaredh159 Yes, you misunderstand docs and maybe what “instance” in React world means.
You are trying to get values from prop
values
. But it does not exists.values
you mentioned are available from instance of decorated component. To understand that, let’s see example:That’s how Instance API works. You can see from example it’s designed for different usecase.
You should use what @niksajanjic suggests…
formValueSelector
+connect
see: http://redux-form.com/6.2.0/examples/selectingFormValues/I hope this explanation will help. 😀
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.