Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
Redux-from with useState - how to connect with value from redux?

Is it possible to substitute the value from useState with the one coming from input? Or is there a way to do this using dispatch? I have tried many ways, but none of them work.

const renderInput = ({
    input,
    label,
    type,
    meta: { asyncValidating, touched, error },
}) => {
    const [value, setValue] = useState('default state');

    const onChange = event => {
        setValue(event.target.value);
        // + some logic here
    };

    return (
        <div>
            <label>{label}</label>
            <div className={asyncValidating ? 'async-validating' : ''}>
                <input {...input} value={value} onChange={onChange} type={type} placeholder={label} />
                {touched && error && <span>{error}</span>}
            </div>
        </div>
    );
};

const SelectingFormValuesForm = props => {

    const { type, handleSubmit, pristine, reset, submitting } = props;

    return (
        <form onSubmit={handleSubmit}>
            <div>
                <label>Name</label>
                <div>
                    <Field
                        name="name"
                        component={renderInput}
                        type="text"
                        placeholder="Dish name..."
                    />
                </div>
            </div>
        </form>
    );
};

SelectingFormValuesForm = reduxForm({
    form: 'selectingFormValues',
    validate,
    asyncValidate,
    // asyncBlurFields: ['name'],
})(SelectingFormValuesForm);

export default SelectingFormValuesForm;

This way, unfortunately, the value sent to the submit remains empty.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda