1. 从生命周期回调中调用。 我有如下代码:
// app.js
<Admin>
<Resource name="FooList" list={FooList} />
</Admin>
// FooList.js
class FooList extends React.Component {
componentDidMount () {
showNotification("foo")
}
}
export default connect(null, {showNotification})(FooList)
Run Code Online (Sandbox Code Playgroud)
当组件安装时,控制台出现错误:
Warning: React does not recognize the `showNotification` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `shownotification` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
Run Code Online (Sandbox Code Playgroud)
2. 调用某个事件(例如点击)。在其他情况下,我有一些处理程序并调用showNotification …