I have created my own component , the following :
import React, { Component, Fragment } from 'react';
import Checkbox from '@material-ui/core/Checkbox';
import clsx from 'clsx';
import { makeStyles } from '@material-ui/core/styles';
function StyledCheckbox(props) {
const classes = useStyles();
let iconClassName;
if (!props.status) {
iconClassName = classes.undoneIcon;
} else if (props.status == 1) {
iconClassName = classes.inProgressIcon;
} else if (props.status == 2) {
iconClassName = classes.checkedIcon;
} else if (props.status == 3) {
iconClassName = "taskStatusCheckboxCANCELED";
}
return (
<Checkbox
className={classes.root + " checklistTaskStyledCheckbox"}
checkedIcon={<span className={clsx(classes.icon, iconClassName)} />}
color="default"
icon={<span className={iconClassName} />}
{...props}
onChange={() => {
props.settaskstatus(props.message)
}}
/>
);
}
export default StyledCheckbox;
So as shown above i need to pass the function settaskstatus called in the onChange eventListener. This used to be simple in react, here the previous shown component markup
<StyledCheckbox
status={this.state.status2}
message={this.props.message}
settaskstatus={this.setTaskStatus}
/>
But now i'm getting this error
backend.js:6 Warning: Invalid value for prop
settaskstatuson tag. Either remove it from the element, or pass a string or number value to keep it in the DOM. For details, see www.fb.me/react-attribute-behavior in span (created by ForwardRef(ButtonBase)) in ForwardRef(ButtonBase) (created by WithStyles(ForwardRef(ButtonBase)))