- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<强>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)
当组件挂载时,控制台出现错误:
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.
<强>2。调用某些事件(例如单击)。在其他情况下,我有一些处理程序并在其中调用 showNotification
。
class Foo extends React.component {
handleClick = () => {
showNotification('Hello, World')
}
}
export default connect(null, { showNotification })(Foo)
在这种情况下 handleClick 被调用,但通知没有出现,但控制台没有错误
下面是我对项目的依赖
"dependencies": {
"@material-ui/core": "1.5.1",
"@material-ui/icons": "3.0.1",
"apollo-boost": "^0.1.22",
"apollo-link-schema": "^1.1.2",
"graphql": "^14.0.2",
"graphql-tag": "^2.10.0",
"graphql-tag.macro": "^2.0.0",
"graphql-tools": "^4.0.3",
"graphql.macro": "^1.0.2",
"material-ui": "^0.20.2",
"ra-core": "^2.4.3",
"ra-data-graphql": "^2.4.3",
"react": "^16.3.2",
"react-admin": "^2.4.3",
"react-dom": "^16.3.3",
"react-material-ui-form-validator": "^2.0.2",
"react-scripts": "^2.1.1",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"seamless-immutable": "^7.1.4"
}
如何在 react-admin 应用程序中显示通知?我错过了什么?
最佳答案
Action 调度器作为组件的属性传入,因此名称为 mapDispatchToProps
。因此,要调用 Action 调度程序,您可以使用 this.props.showNotification('Hello, World')
关于reactjs - react-admin 中的 showNotification 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54062100/
我正在尝试将我的网站通知从浏览器推送到 Android 和 PC,为此我尝试过 push notifications . 我按照文档并输入了以下代码 - Notification.requestPer
我正在使用 serviceworker-webpack-plugin在我的 reactjs 应用程序中创建服务 worker 。 我关注了the example在主线程中注册服务 worker 。我了
1。从生命周期回调调用。我有如下代码: // app.js // FooList.js class FooList extends React.Component { compo
我正在考虑自定义 Shiny 的 showNotification() 功能。 https://gallery.shinyapps.io/116-notifications/ 我希望在屏幕中间而不是右
本文整理了Java中com.haulmont.cuba.gui.WindowManager.showNotification()方法的一些代码示例,展示了WindowManager.showNotif
我正在使用MVVM方法在ZK项目中工作,我想做的是显示@bind(each.info)值的通知,但似乎不适合我,这是到目前为止我所做的。
我正在使用 TwinPushSDK 接收使用 Swift 语言的通知。 http://developers.twinpush.com/developers/ios?class=sidebar-head
我是一名优秀的程序员,十分优秀!