When calling onDelete on a chip. The Event should bring back its proper name.
Returns Undefined.
See https://codesandbox.io/s/j4qv2q0k85
| Tech | Version |
|--------------|---------|
| @material-ui/core | 3.4.0|
The workaround is to do:
import ReactDOM from "react-dom";
import React from "react";
import { Chip } from "@material-ui/core";
class App extends React.Component {
checkListToggle = name => event => {
alert(name);
};
render() {
return (
<div>
<Chip
name="keyName"
label="keyname"
color="primary"
onDelete={this.checkListToggle('keyName')}
/>
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById("root"));
Thank you for a response. I can do a workaround without a problem. However, that workaround it not allowed by es lint because of no-multi-assign
. I just thought it might be a good idea to change the behavior. Not sure if its that big pressing issue for you guys.
try something like: onDelete={checkListToggle.bind(this, 'keyName')}
Worked in my case
Most helpful comment
try something like:
onDelete={checkListToggle.bind(this, 'keyName')}
Worked in my case