mirror of
https://github.com/penpot/penpot.git
synced 2025-07-30 16:18:32 +02:00
✨ Deprecate uxbox.util.components.
This commit is contained in:
parent
a7ffbd8a27
commit
4c36bce5bd
5 changed files with 72 additions and 13 deletions
25
frontend/src/uxbox/main/ui/react_hooks.cljs
Normal file
25
frontend/src/uxbox/main/ui/react_hooks.cljs
Normal 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))
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue