(<-deref a)
Takes an atom. Returns the currently derefed value of the atom, and re-renders the component on change.
Takes an atom. Returns the currently derefed value of the atom, and re-renders the component on change.
(useCallback f)
(useCallback f deps)
Just react/useCallback
Just react/useCallback
(useEffect f)
(useEffect f deps)
Just react/useEffect
Just react/useEffect
(useImperativeHandle ref create-handle)
(useImperativeHandle ref create-handle deps)
Just react/useImperativeHandle
Just react/useImperativeHandle
(useIRef initial)
Takes an initial value. Returns an atom that will NOT re-render component on change.
Takes an initial value. Returns an atom that will _NOT_ re-render component on change.
(useLayoutEffect f)
(useLayoutEffect f deps)
Just react/useLayoutEffect
Just react/useLayoutEffect
(useReducer reducer init-state)
(useReducer reducer init-state init)
Just react/useReducer.
Just react/useReducer.
(useState initial)
(useState initial eq?)
Like React.useState
, but the update function returned can be used similar
to swap!
.
Example:
(let [[state set-state] (useState {:count 0})]
;; ...
(set-state update :count inc))
If eq?
is passed in, will use that function to determine whether to update
the React state. If it returns true
, it will keep the old state, false
it
will render with new state.
Like `React.useState`, but the update function returned can be used similar to `swap!`. Example: ``` (let [[state set-state] (useState {:count 0})] ;; ... (set-state update :count inc)) ``` If `eq?` is passed in, will use that function to determine whether to update the React state. If it returns `true`, it will keep the old state, `false` it will render with new state.
(useValue x)
Caches x
. When a new x
is passed in, returns new x
only if it is
not structurally equal to the previous x
.
Useful for optimizing <-effect
et. al. when you have two values that might
be structurally equal by referentially different.
Caches `x`. When a new `x` is passed in, returns new `x` only if it is not structurally equal to the previous `x`. Useful for optimizing `<-effect` et. al. when you have two values that might be structurally equal by referentially different.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close