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
When writing a component, you may need the form name, but not anything else. This is completely impossible. The only way is to use something like formValues(''), like so:
I can't always know the name of my form, can I? We've gor a million different forms, and a component, that might not be a Field, must be reusable within any form. Simple as that.
The above is a hack to achieve this. There is no other way to get to the form name within the connect() call. There should be a proper way to do this.
Your environment
Software
Version(s)
redux-form
8.3.7
redux
4.0.5
react-redux
7.2.3
react
17.0.2
react-dom
17.0.2
node
14.17
npm if using
whatever comes with Node.js
Browser
Firefox latest
Operating System
Windows 10
Steps to reproduce
Can't reproduce what's impossible, can I...
Expected behaviour
Opposite of actual behaviour.
Actual behaviour
See description.
Other information
Sorry to be short, but I just wasted 1,5 hours of fiddling around to figure out how to get the damn form name. It shouldn't be so hard. Also, I'm delibrately not issuing this as a feature request, because getting the form name is so utterly basic, that it probably just needs to be exposed, possibly by exporting withReduxForm.
The text was updated successfully, but these errors were encountered:
If you set your form name by passing a 'form' prop into your form component, rather than via reduxForm({form: 'xxx'}), it will be available from props within connect((state, props) => {})
Impossible to get form name within connect()
When writing a component, you may need the form name, but not anything else. This is completely impossible. The only way is to use something like
formValues('')
, like so:I can't always know the name of my form, can I? We've gor a million different forms, and a component, that might not be a Field, must be reusable within any form. Simple as that.
The above is a hack to achieve this. There is no other way to get to the form name within the
connect()
call. There should be a proper way to do this.Your environment
redux-form
redux
react-redux
react
react-dom
node
npm
if usingSteps to reproduce
Can't reproduce what's impossible, can I...
Expected behaviour
Opposite of actual behaviour.
Actual behaviour
See description.
Other information
Sorry to be short, but I just wasted 1,5 hours of fiddling around to figure out how to get the damn form name. It shouldn't be so hard. Also, I'm delibrately not issuing this as a feature request, because getting the form name is so utterly basic, that it probably just needs to be exposed, possibly by exporting
withReduxForm
.The text was updated successfully, but these errors were encountered: