Custom Input Component

When using custom input components, they must be passed in as props, like so:

<EasyEdit    
    type="text"
    onSave={() => {}}
    editComponent={<CustomInput />}    
    displayComponent={<CustomDisplay />}
/>

When defining a custom input component, the function setParentValue is injected into your custom component, which must be called in order to pass the desired value up to the parent EasyEdit component.

For example, if your component was a text field that needed to set the EasyEdit value as a user id based on a username entered, you would need to pass the id to this.props.setParentValue in order to get that value to the EasyEdit component.

e.g.

// Inside your custom 
input​onChange(searchTerm) {
    getUserIdByUsername(searchTerm).then((userId) => {
    this.props.setParentValue(userId);
})}

Last updated