Failed prop type: Invalid prop `form` of type `object` supplied to `Form(App)`, expected `string`
See original GitHub issueI have the following form: It’s almost same as Simple Form.
import React from 'react'
import { Field, reduxForm } from 'redux-form'
const App = (props) => {
const { handleSubmit, pristine, reset, submitting } = props
return (
<form onSubmit={handleSubmit}>
<div>
<label>First Name</label>
<div>
<Field name="firstName" component="input" type="text" placeholder="First Name"/>
</div>
</div>
<div>
<label>Last Name</label>
<div>
<Field name="lastName" component="input" type="text" placeholder="Last Name"/>
</div>
</div>
<div>
<label>Email</label>
<div>
<Field name="email" component="input" type="email" placeholder="Email"/>
</div>
</div>
<div>
<label>Sex</label>
<div>
<label><Field name="sex" component="input" type="radio" value="male"/> Male</label>
<label><Field name="sex" component="input" type="radio" value="female"/> Female</label>
</div>
</div>
<div>
<label>Favorite Color</label>
<div>
<Field name="favoriteColor" component="select">
<option></option>
<option value="ff0000">Red</option>
<option value="00ff00">Green</option>
<option value="0000ff">Blue</option>
</Field>
</div>
</div>
<div>
<label htmlFor="employed">Employed</label>
<div>
<Field name="employed" id="employed" component="input" type="checkbox"/>
</div>
</div>
<div>
<label>Notes</label>
<div>
<Field name="notes" component="textarea"/>
</div>
</div>
<div>
<button type="submit" disabled={pristine || submitting}>Submit</button>
<button type="button" disabled={pristine || submitting} onClick={reset}>Clear Values</button>
</div>
</form>
)
}
export default reduxForm({
form: 'app' // a unique identifier for this form
})(App)
I get the following error:
warning.js:36Warning: Failed prop type: Invalid prop `form` of type `object` supplied to `Form(App)`, expected `string`.
in Form(App) (created by Connect(Form(App)))
in Connect(Form(App)) (created by ReduxForm)
in ReduxForm (created by Connect(ReduxForm))
in Connect(ReduxForm) (at index.js:12)
in Provider (at index.js:11)
I checked the prop of the Connect(Form(App)).
Why is the prop ‘form’ recognized as Object (not string)? And I want to know how to solve this problem.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Warning: Failed prop type: Invalid prop `label` of type `object ...
It means you're providing the wrong type to the label prop. It only expects a string, but you're passing a react fragment. Change...
Read more >invalid prop `rows` of type `object` supplied to `forwardref ...
I am using react-native-snap-carousel, It worked fine, It fetches data fine but i am getting 2 warnings in that app. Warning: Failed prop...
Read more >Warning: Failed prop type: Invalid prop `children` supplied to ...
Warning: Failed prop type: Invalid prop `children` supplied to `ForwardRef(Typography)`, expected a ReactNode. */<Typography key={item.id}>
Read more >Warning: Invalid prop `renderChatItem` - Sendbird Community
This looks like a wrong prop type given to the renderChatItem prop on our side, that expects a React Element instead of a...
Read more >prop-types - npm
You might also see this error if you're calling a PropTypes validator from your own custom PropTypes validator. In this case, the fix...
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
Never mind, found the answer 😃 in my case one of my props was also named “form”, renamed it to something else.
I had the same issue.
I found a way around it by using a different property name other than ‘form’ on mapStatetoProps