clojurescript - 重新框架:未注册事件处理程序
问题描述
我的重新框架 views.cljs 有:
(re-frame/dispatch [::re-graph/init
{:http-url "https://api.spacex.land/graphql"
:ws-url nil
:http-parameters {:with-credentials? false}}])
(re-frame/dispatch [::re-graph/query
"{ launches { id, mission_name } }" ;; your graphql query
[::update-data]])
我的 events.cljs 有:
(re-frame/reg-event-db
::update-data
(fn [db [_ {:keys [data errors] :as payload}]]
(-> db
(assoc :errors errors)
(assoc :data data))))
但我不断收到此错误:
core.cljs:3919 re-frame: no :event handler registered for: undefined
解决方案
解决方案是包含nil
查询变量
(re-frame/dispatch
[::re-graph/query
"{launches {id, mission_name}}"
nil
[:add-launches]])
推荐阅读
- html - 禁用垫菜单中的滚动条
- html - 阻止 Bootstrap 4 页脚上升
- sql - Sql 代理作业上次运行状态
- javascript - 命令失败:java -jar
- r - 如何将数据帧传递给函数并将输出放回数据帧
- javascript - 以下 jQuery 代码的 JavaScript 等效项是什么?
- php - 如果特定酒店(度假村)的房间类型不止一种,我如何在下拉菜单中填充度假村(酒店)的房间类型?
- java - java.security.NoSuchAlgorithmException:没有这样的算法:提供者 BCJSSE 的 TLS1.2
- safari - Safari.app 启动时如何自动运行 AppleScript?
- python-3.x - 将 RoboBrowser 与 Requests-HTML 相结合