Writing resize events that don't change app-db

There are certain events that do not lead to change app-db. They change only dom, for example: start custom scrolling, get selected text, etc. How do I handle them in re-frame, since the event handler requires the return of a new app-db? I am returning to the existing dB, but this does not seem to be correct. Is there a better way to do this? Some of my handlers look like this:

 (re-frame/reg-event-db
    :init-link-viewer
    (fn [db [_ highlights]]
      (utils/load-highlights highlights)
      (utils/init-selection)
      db))
+4
source share
1 answer

reg-event-fx , ( reg-event-db, db). db. . Effects .

:

(reg-event-fx
  :init-link-viewer
  (fn [db [_ highlights]]
    (utils/load-highlights highlights)
    (utils/init-selection)
    {}))

. , . , . :

(reg-event-fx
  :init-link-viewer
  (fn [db [_ highlights]]
    {:load-highlights highlights
     :init-selection true}))
+4

Source: https://habr.com/ru/post/1658168/


All Articles