I am having some trouble trying to render a simple material-ui-next checkbox inside a redux-form. I am following the official example and trying to adapt it to the material-ui-next equivalent, since the example is using the older version of material-ui. This is the code that I end up using:
const renderCheckbox = ({ input, label }) => (
<FormGroup row>
<FormControlLabel
control={
<Checkbox
checked={input.value ? true : false}
onChange={input.onChange}
value="checkedA"
/>
}
label="Secondary"
/>
</FormGroup>
);
And this is how I define the checkbox inside redux-form:
...
<Field name="activated" component={renderCheckbox} label="Activated" />
...
However when I save the code, React is complaining with the following error:
index.js:2178 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check your code at myForm.js:108.
Line 108 of the code is the <Checkbox /> component that is defined inside the aforementioned renderCheckbox() method.
Checkboxcomponent based on the error line number.