即使调用了 :component-did-update,form-3 组件也不会重新呈现任何内容

form-3 component not rerendering anything even though :component-did-update is called

我有以下代码来测试 form-3 组件:

(defn inner [data]
  (reagent/create-class
   {:display-name "Counter"

    :component-did-mount (fn []
                           (js/console.log "Initialized")
                           [:h1 "Initialized! " data])


    :component-did-update (fn [this _]
                            (let [[_ data] (reagent/argv this)]
                              (js/console.log (str "Updated " data))
                              [:div (str "My clicks " data)]))

    :reagent-render (fn [] [:div (str "My clicks " data)])}))

我能够成功触发 :component-did-mount:component-did-update,因为控制台日志中有预期的输出。然而,这两个函数实际上都没有改变页面上的任何内容。它只是显示整个时间 [:div (str "My clicks " data)] 的初始状态。

我做错了什么? Ps。我已阅读 reagent docs and the purelyfunctional guide.

您必须 repeat the parameters:reagent-render 函数中:

(fn [data] [:div (str "My clicks " data)])