Using redux-form I’m losing focus after typing the first character

This happens because you’re re-defining renderField as a new component every time you render which means it looks like a new component to React so it’ll unmount the original one and re-mounts the new one. You’ll need to hoist it up: const renderField = ({ input, label, type, meta: { touched, invalid, error } }) … Read more

redux-form is Destroying my state once the component is unmounted, what gives?

The form’s state subtree is destroyed when the form is unmounted, by design. This is the default and expected behaviour. From v6.2.1 onwards there is a form config property destroyOnUnmount, which explicitly enables/disables the state-clearing behaviour on a specific form (docs here) import { reduxForm } from ‘redux-form’; reduxForm({ form: ‘example’, destroyOnUnmount: false })(…) This … Read more

Programmatically change Redux-Form Field value

You can have the onChange logic in this.handleSelectChange({ value, type: input.name }) and use change action from redux-form According to the docs: change(field:String, value:any) : Function Changes the value of a field in the Redux store. This is a bound action creator, so it returns nothing. Code: import { change } from “redux-form”; handleSelectChange = … Read more

I am using Redux. Should I manage controlled input state in the Redux store or use setState at the component level?

I like this answer from one of the Redux co-authors: https://github.com/reactjs/redux/issues/1287 Use React for ephemeral state that doesn’t matter to the app globally and doesn’t mutate in complex ways. For example, a toggle in some UI element, a form input state. Use Redux for state that matters globally or is mutated in complex ways. For … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)