Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!