Deprecate uxbox.util.components.

This commit is contained in:
Andrey Antukh 2020-03-18 09:52:13 +01:00
parent a7ffbd8a27
commit 4c36bce5bd
5 changed files with 72 additions and 13 deletions

View file

@ -0,0 +1,25 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs S.L
(ns uxbox.main.ui.react-hooks
"A collection of general purpose react hooks."
(:require
[beicon.core :as rx]
[rumext.alpha :as mf]))
(defn use-rxsub
[ob]
(let [[state reset-state!] (mf/useState @ob)]
(mf/useEffect
(fn []
(let [sub (rx/subscribe ob #(reset-state! %))]
#(rx/cancel! sub)))
#js [ob])
state))