score:2
Accepted answer
I encountered the same problem when I was trying to pass undefined
as the input value.
To fix this, ensure that you are passing at least empty string to the input, not undefined
const Field = ({ field, onFieldChange, value }) => (
<input
value={value || ''} // <- add fallback value here
onChange={(event) => { onFieldChange(field, event.target.value) }}
type="text"
/>
)
score:1
- Actually you might try to make your component statefull - store and manage value of input inside of it (they say it's ok).
- Or if you really need this value in the store use redux-form, I have realy good experience of using it (you'll have to write less boilerplate code).
By the way, you will not have to use any custom plugin, you can use
initialValues
, see more here
The solution above will work for sure, but it doesn't seem to be nice.
Source: stackoverflow.com
Related Query
- How to update a field value after action dispatched with redux
- How to an update an api call after an action is dispatched with a dependant value which is updated
- How to use the updated value in redux store immediately after the action is dispatched in react js functional components
- How to listen for specific property changes in Redux store after an action is dispatched
- How to dynamically update the value for any input field with one event handler function, using hooks
- How to update specific form field in formik when value changes in redux store?
- React redux update input field with user text after data filled from API
- How do I get my view to update after an item was removed from my store/State in React with Redux
- How to update input field according to a value of select field using React.js with Formik?
- How to update value in input and drop-down after re-rendering the component with updated value?
- How to update single value inside specific array item in redux
- How to set/change Field value from external user action 🏁 React Final Form
- How to update the Redux store after Apollo GraphQL query returns
- How do you update Formik initial values with the react context api values after an AJAX request?
- React Navigation: How to update navigation title for parent, when value comes from redux and gets updated in child?
- How do I call setState with the previous state plus an additional value in a redux connected controlled component?
- How to call redux action after success of another action?
- After deploying a Github page, how do you update it with changes?
- How do I programatically fill input field value with React?
- How to set defaultValue, value={this.props.value}, and update the value of a text input with React?
- How to update single value inside array in redux
- How to fetch data by existing redux action with hooks?
- Redux state doesn't update with action dispatch
- A component is changing the default value state of an uncontrolled Slider after being initialized. Material UI Slider with Redux State
- Redux Toolkit: How to refer action created with createAction as type
- How I can update array field value in redux-form?
- How to test redux state update with react testing library and jest
- How to update state of a component with value from reducer state in react-redux?
- React Redux with redux-observable use the router to navigate to a different page after async action complete
- How to update with React Hooks specific value of an array inside an object?
More Query from same tag
- How to mix component level scss and global styles in nextjs
- Tailwind CSS, positioning one image over another
- theme does not recognize material-ui
- How to upgrade Polaris?
- How come I can't spread props with Typescript?
- how to debug code with console.log when the code runs slow
- React Route doesn't pick up the url change
- Exporting in React higher order components
- Trying to set & send a state variable as an URL string in a POST request with a single button click
- TypeScript Interface Issue with JSX.Element in React
- Is there a way to implement horizontal timeline using Material UI in React?
- How to make list of emits with intervals from Node.js to React using socket.io?
- Proper use of UseCallBack
- Next.js Fetch and Maintain global data for all components
- Ant design Form validation is not working and not updating input values when component is from a state that is passed from a function
- Firebase Storage: Invalid argument in `put` Expected Blob or File
- close datepicker menu using button-reactjs
- How to sinon spy a React component constructor - unit testing?
- How can I configure react-router to with nginx/cherrypy and my current reactjs app
- How to check form is valid or not in react + material?
- How to "view on Google maps" with react-google-maps
- Unable to find solution - showing error in this way - "Attempted import error: 'date-fns' does not contain a default export (imported as 'dateFns')."
- Redux Form Variables
- React Duplicate components updating wrong state: hooks
- How to use context in ReactJS to change the property in different function
- Writing to files using File System Access API fails in Electron + Create React App
- Custom hook returns Promise but resolves inside useEffect
- React redux, array state not updating
- Resolve location dependency warning in React useEffect hook
- How to properly access props inside a component