score:0
you are confusing v5
syntax with v6
syntax. in v6
, your decorated form component is no longer passed this.props.fields
. re-read the migration guide, like @tyler-iguchi said.
score:2
there were breaking changes in redux-forms from v5 to v6. previously you could do something similar to what you have to access the touched field. if you want to do something similar to see if there are errors on a field, you need to create your own component to pass to redux-form's field component.
your custom component
const customcomponent = function(field) {
return (
<div>
<input
type={field.type}
{...field.input}
/>
{field.meta.touched && field.meta.error && <div classname='error'>{field.meta.error}</div>}
</div>
)
}
then using it with the field component
<field name="my-prop" component={customcomponent} />
also take a look at the migration guide, hope this helps!
Source: stackoverflow.com
Related Query
- Why does redux form return string instead of the object?
- Why does this React component return the string '0'
- Why does useIsMounted return a callback instead of the value itself?
- Why does trim() not work for setting a string within an object (related to type, not the nature of the state)
- Why does react keep changing into an unecessary timezone I just want to create a date object with the same date in the string
- Why does redux not dispatch the updated object to the store?
- Why does my Redux props object return undefined?
- Why does using string.split() on a string of length one where the delimiter is the same as the string value return an array of length two
- Why does Redux Promise return unresolved promise if more than type and payload options are specified?
- Why is Redux passing dispatch into the return function of an action?
- Why does the name of the state object not need to match the name in setState?
- Redux Form - Return current input value as string onChange
- Why does React re-render differently whether the state is an object vs a string?
- Why am I unable to manipulate my form object in the state?
- Redux reducer gets string instead of object
- Why does Appbase return 'undefined' before returning the correct item?
- Why does my function on the server return true but returns false on the client side in Meteor.js
- Why does toJS() return an empty object when applied on observable object? - MobX
- Why does setState empty the state object, instead of removing it?
- why does redux need to make a copy of the data each time it changes?
- Why does the form not receive select data in AntD?
- React Hooks Form Handling: Update the state of an object with multiple string items and one array item
- compare 2 object arrays and return the elements in first array as true if it exists in second array, or as false if it does not
- React Redux sync action returns some Proxy object instead of string
- Redux toolkit combineReducers problem.:Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose
- Why does reverse() work if the value of useState is an object and not if it is an array?
- Why does Redux saves my regex value as an object type
- why does it return undefined from this redux dispatch?
- Redux - returning an array instead of an object in the reducer
- How to return the data which receive from Axios in Object form
More Query from same tag
- Draft js add new block on return key
- I cant use java script on flutter
- export functional component with injectIntl without using default export
- Importing Mousetrap in React project - Cannot read property 'bind' of undefined
- React-router: ProtectedRoute authentication logic not working
- mobx-react-lite useObserver hook outside of render
- why is afterSetExtremes function being called twice highcharts using react
- Invariant Violation using react-native-svg
- React file upload returns undefined
- How to set nginx to serve React and Django properly
- How to add a parameter to an API call function in react
- additional paths with azure web app returns error
- Passing variables between React Components to initialize a rendering after an user login
- Adding data to array using UseState onChange
- How to autofocus react textarea?
- ReactJS - async function in useEffect doesn't wait under any condition
- React hook arguments cause infinite rerendering
- React styled-components not applying styles to components
- How to keep old data in REACT component
- map the result to the invert ReactJS
- How to deal with nested useEffect?
- Set up webpack to run locally on a custom domain over HTTPS
- Format string from database into a url link with react, react-router, react-bootstrap-table
- How to have different color for alternate row for MUI v4 Table?
- React, Typescript - Print fetched data
- React Higher order components, that modifies the input element of wrapped component in it
- How to chain React Context dispatch? (Hooks)
- React Router v5 - How to force a route to always re-render when location changes?
- Is this discouraged for HOC in React?
- Filter react-admin query by dates