如何将 Hickory 与 Clojurescript (OM/Reagent) 结合使用?

How to use Hickory with Clojurescript (OM/Reagent)?

在我的 Reagent 项目中,我正在使用 Hickory 解析 HTML 并呈现 Hiccup 页面。出现打嗝。但是当我更改页面时(!重置我的视图 atom),React.js 变得疯狂,因为 Hickory 生成了:

[:div (as-hiccup (parse "<h1>HELLO WORLD!</h1>"))]

=> ([:html {} [:head {}] [:body {} [:h1 {} HELLO WORLD!]]])

如您所见,它生成了 <html> <head> <body> 标签,我认为这会导致 Reactjs 崩溃,因为我的视图已经有了这些标签。理想情况下,我希望它只生成 [:h1 {} HELLO WORLD!]

(map as-hiccup (parse-fragment "<h1>HELLO WORLD!</h1>"))

生成[:h1 "HELLO WORLD!"]