rumext.v2
browser-context?
A boolean var, indicates if the current code is running on browser main thread or not.
check-props
(check-props props)
(check-props props eqfn?)
Utility function to use with memo'
. Will check the props
keys to see if they are equal.
Usage:
(mf/defc my-component
{::mf/wrap [#(mf/memo' % (mf/check-props ["prop1" "prop2"]))]}
[props]
)
check-props
macro
(check-props props & [eq-f :as rest])
A macro version of the check-props
function
defc
macro
(defc & args)
A macro for defining component functions. Look the user guide for understand how to use it.
defc
macro
(defc & args)
A macro for defining component functions. Look the user guide for understand how to use it.
deferred
(deferred component)
(deferred component sfn)
A higher-order component that just deffers the first render to the next tick
deps
(deps)
(deps a)
(deps a b)
(deps a b c)
(deps a b c d)
(deps a b c d e)
(deps a b c d e f)
(deps a b c d e f g)
(deps a b c d e f g h)
(deps a b c d e f g h & rest)
A helper for creating hook deps array, that handles some adaptations for clojure specific data types such that UUID and keywords
deref
(deref iref)
A rumext hook for deref and watch an atom or atom like object. It internally uses the react.useSyncExternalSource API
element
(element klass)
(element klass props)
Create a react element. This is a public API for the internal jsx
function
fnc
macro
(fnc & args)
A macro for defining inline component functions. Look the user guide for understand how to use it.
fnc
macro
(fnc & args)
A macro for defining inline component functions. Look the user guide for understand how to use it.
hydrate-root
Lets you display React components inside a browser DOM node whose HTML content was previously generated by react-dom/server
lazy-component
macro
(lazy-component ns-sym)
A macro that helps defining lazy-loading components with the help of shadow-cljs tooling.
lazy-component
macro
(lazy-component ns-sym)
A macro that helps defining lazy-loading components with the help of shadow-cljs tooling.
memo
(memo component)
(memo component eq?)
High order component for memoizing component props. Is a rumext variant of React.memo what accepts a value comparator function (instead of props comparator)
props
macro
(props value)
A helper for convert literal datastructures into js data structures at compile time using react props convention.
props
macro
(props value)
A helper for convert literal datastructures into js data structures at compile time using react props convention.
spread-object
macro
(spread-object target other)
A helper for spread two js objects, adapting compile time known keys to cameCase.
You can pass :rumext.v2/transform false
on other
metadata for disable key casing transformation.
spread-object
macro
(spread-object target other)
A helper for spread two js objects, adapting compile time known keys to cameCase.
You can pass :rumext.v2/transform false
on other
metadata for disable key casing transformation.
spread-props
macro
(spread-props target other)
A helper for spread two js objects using react conventions for compile time known props keys names.
spread-props
macro
(spread-props target other)
A helper for spread two js objects using react conventions for compile time known props keys names.
use-callback
(use-callback f)
(use-callback deps f)
A rumext variant of the useCallback
hook function with order of arguments inverted
use-debounce
(use-debounce ms value)
A rumext custom hook that debounces the value changes
use-effect
(use-effect f)
(use-effect deps f)
A rumext variant of the useEffect
hook function with order of arguments inverted
use-equal-memo
(use-equal-memo val)
(use-equal-memo eqfn val)
A rumext custom hook that preserves object identity through using a =
(value equality). Optionally, you can provide your own function.
use-insertion-effect
(use-insertion-effect f)
(use-insertion-effect deps f)
A rumext variant of the useInsertionEffect
hook function with order of arguments inverted
use-layout-effect
(use-layout-effect f)
(use-layout-effect deps f)
A rumext variant of the useLayoutEffect
hook function with order of arguments inverted
use-memo
(use-memo f)
(use-memo deps f)
A rumext variant of the useMemo
hook function with order of arguments inverted
use-previous
(use-previous value)
A rumext custom hook that returns a value from previous render
use-ref-fn
(use-ref-fn f)
A rumext custom hook that returns a stable callback pointer what calls the interned callback. The interned callback will be automatically updated on each render if the reference changes and works as noop if the pointer references to nil value.
use-ssr-effect
(use-ssr-effect deps effect-fn)
An EXPERIMENTAL use-effect version that detects if we are in a NON browser context and runs the effect fn inmediatelly.
use-state
(use-state)
(use-state initial)
A rumext variant of useState
. Returns an object that implements the Atom protocols.
use-transition
(use-transition)
A rumext version of the useTransition
hook function. Returns a function object that implements the IPending protocol for check the state of the transition.
use-update-ref
(use-update-ref value)
A rumext custom hook that updates the ref value if the value changes
use-var
(use-var)
(use-var initial)
A rumext custom hook that uses useRef
under the hood. Returns an object that implements the Atom protocols. The updates does not trigger rerender.
with-effect
macro
(with-effect deps & body)
A convenience syntactic abstraction (macro) for useEffect
with-effect
macro
(with-effect deps & body)
A convenience syntactic abstraction (macro) for useEffect
with-layout-effect
macro
(with-layout-effect deps & body)
A convenience syntactic abstraction (macro) for useLayoutEffect
with-layout-effect
macro
(with-layout-effect deps & body)
A convenience syntactic abstraction (macro) for useLayoutEffect
with-memo
macro
(with-memo deps & body)
A convenience syntactic abstraction (macro) for useMemo
with-memo
macro
(with-memo deps & body)
A convenience syntactic abstraction (macro) for useMemo