ReactJS: How to wrap react-select in redux-form field?

后端 未结 5 1078
难免孤独
难免孤独 2021-02-13 02:57

I am working on react-select library and facing some issues, I am using redux-form library and importing component from it

5条回答
  •  旧时难觅i
    2021-02-13 03:30

    Use this which works perfectly and it also handles redux form validation.

    import React, {Component} from 'react';
    import Select from 'react-select';
    import {FormGroup} from "reactstrap";
    
    
    class CustomSelect extends Component {
    
     render() {
       const {meta: {touched, error}} = this.props;
       const className = ` form-group mb-3 ${touched && error ? 'has-danger' : '' }`;
       return (    
            
                    
                            
        
    提交评论

提交回复
热议问题