To use existing components library in a form (such as Material UI) - a map from the Jafar component generic props to the existing component props is needed.
Example - mapping props using react functional component
/* Input.js */
import React from 'react';
import Input from '@material-ui/core/Input';
export default ({ value = '', state = {}, disabled = false, onValueChange }) => <Input
type={state.type}
placeholder={state.placeholder}
value={value}
disabled={disabled}
onChange={(e) => onValueChange(e.target.value)}
/>
Example - mapping props using a desired toJafar HOC
To use existing components library in a form (such as Material UI) - a map from the Jafar component generic props to the existing component props is needed.
Example - mapping props using react functional component
Example - mapping props using a desired toJafar HOC
Using the above HOC saves the react import as well as simplify tests. The following code tests mapper function with a simple javascript test.