Does redux-form field value can hold object instead of just a string?

后端 未结 5 1184
暖寄归人
暖寄归人 2020-12-31 18:10

Does redux-form field value can hold object instead of just a string?

Consider following example

    class SelectQuestions extends Component{
                


        
5条回答
  •  长情又很酷
    2020-12-31 18:34

    This is a bit late, but still..

    Yes, it can! You can simply use a FormSection here.

    It will split your form to an objects under the hood, and will keep all sections separtely in your single form object.

    Just need to pass a name prop to the FormSection, that will be a name of your sub-object.

    import { FormSection } from 'redux-form';
    
    render(){
      return(
          
    ) }

    Then check your form structure through the Redux devTools.

    Enjoy ;)

提交回复
热议问题