-
-
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
form and forms in reducer #1906
Comments
Most if not all of the redux-form examples mount the The warning you pasted looks like the Do you use |
Here is my form container import GiftCertificate from '../components/gift-certificate.jsx'; const { func, object, arrayOf } = React.PropTypes; class CompletePurchase extends Component { static propTypes = {
} const completePurchase = reduxForm({ export default connect( |
Thank you for posting this complete code sample! By mounting the formReducer at This redux store's state is passed to I hope this helped a bit. |
helped a bit but I am not sure I follow. so is reduxForm a form a connect and should be treated like one? or does the reduxForm completePurchase need to be added to my state in the connect? Thanks for the help. |
I am not sure I understand this question correctly. Redux-form and connect are similar in that they create higher order components. They enrich the thing they wrap. By using Now it might be that you need other properties mapped from the redux store state or dispatch. Here you can use Maybe installing the react and redux developer tools for Chrome can visualise this better. |
I set this up based off of this example and the only difference to me is that the component is a stateless function. so I have the redux and react dev tools and I am still not seeing anything fishy. |
@drifterz28 your reducer needs to use the
|
That was changed back... I should update that, but now it is. |
you need to remove export default connect( |
Yeah, I have removed |
are you manually passing in a
somewhere you're overriding that |
I spent also about one hour on this. Maybe a better hint would be useful? Like "Did you pass "form" slice from redux state as a prop in? It is overwriting the "form" key property of redux-forms! So remove it in your mapStateToProps or mount the form state at a slice name different from >form<" This object instead of a string error message is extremly hard to reason about. |
Because this issue saw almost no activity for almost a year, I'm closing 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. |
Reading the docs and building the reducer is listed as form when form collides with the props form from redux-form and gives back "object object" as the form type in the main props.
error
warning.js:36 Warning: Failed prop type: Invalid prop
formof type
objectsupplied to
Form(Test), expected
string.
my reducer
const rootReducer = combineReducers({ event, form: formReducer, hold, inventories });
solution
const rootReducer = combineReducers({ event, forms: formReducer, hold, inventories });
http://redux-form.com/6.0.2/docs/api/Reducer.md/
https://github.com/erikras/redux-form/blob/master/src/reduxForm.js#L110
spend some time on this and naming the form to forms in the reducer fixed the issue.
updating the docs should fix this issue. looking into pull request if that is what is observed from others.
sorry if I suck at explaining this issue / observation.
The text was updated successfully, but these errors were encountered: