How to create a ReferenceInput wrapped component?

前端 未结 2 625
野的像风
野的像风 2021-01-25 16:10

I\'m trying to create a wrap component that includes admin-on-rest ReferenceInput

What am I missing?

I have seen the answer Error on Creating custom ReferenceIn

2条回答
  •  终归单人心
    2021-01-25 16:51

    I found a (the?) solution.

    We need to use a redux-form Field component in Simpleform.

      import { Field } from 'redux-form';
    
      export const commentsCreate = (props) => (
        
          
            
          
        
      );
    
      const Prueba = (props) => (
        
          
        
      );
    

    From https://redux-form.com/6.0.0-alpha.4/docs/api/field.md/

    The Field component is how you connect each individual input to the Redux store. There are three fundamental things that you need to understand in order to use Field correctly:

    The name prop is required. It is a string path, in dot-and-bracket notation, corresponding to a value in the form values. It may be as simple as 'firstName' or as complicated as contact.billing.address[2].phones[1].areaCode.

    The component prop is required. It may be a Component, a stateless function, or a factory, like those provided under React.DOM. See Usage section below. To learn about the props that will provided to whatever your component is, see the Props section below.

    All other props will be passed along to the element generated by the component prop.

提交回复
热议问题