alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

Formik and Form.Check does not capture value in react js ?

Formik and Form.Check does not capture value in react js ?

I was able to fix it and thought to post the answer in case it helps someone else a a later stage

 {['Football', 'Golf', 'Rugby', 'Tennis'].map((secondaryinterest) => (
            <div key={`${secondaryinterest}`} className="mb-3">
                <Form.Check
                    type='checkbox'
                    name='secondaryinterest'
                    value={`${secondaryinterest}`}
                    label={`${secondaryinterest}`}
                    onChange={formik.handleChange}
                />
            </div>
        ))} 

I stipulated the name and value fields. Also the {...formik.getFieldProps('secondaryinterest')} was redundant.


22 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online