javascript - 复选框 onCheck 不会触发

标签 javascript reactjs material-ui mobx

我有一个来自 Material-ui 的复选框,它不会触发 onCheck 事件。

<Checkbox
  label="label"
  onCheck={onCheck}
  checked={currentDocument.ispublic}
/>


function onCheck() {
  currentDocument.ispublic = !currentDocument.ispublic;
  console.log("onCheck");
}

我尝试按照此问题中的描述删除已检查的属性:React Checkbox not sending onChange

currentDocument 是存储在我的商店中的可观察对象。

最佳答案

难道是因为基于https://material-ui-next.com/api/checkbox/#checkbox Material-ui 暴露了 onChange 而不是 onCheck?

关于javascript - 复选框 onCheck 不会触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48885894/

相关文章:

javascript - 更改 javascript 中输入的匹配文本的文本颜色

javascript - React reducer(将对象键添加到对象)

javascript - react 谷歌地图 API :Cannot read properties of undefined reading 'emit'

javascript ajax 登录表单处理

javascript - 无法从后台脚本以外的脚本访问 chrome 对象或 chrome.tabs 对象

javascript - 如何在 Express 中设置自定义图标?

node.js - 在我的 React api 中发送 header 后无法设置 header

javascript - 下一个/React-Apollo : React props not hooked up to apollo cache when query comes from getInitialProps

css - 如何在 Material-UI 中使图像稍微偏离对话框

material-ui - 如何对嵌套元素使用主题覆盖?