($ type & args)
Create a new React element from a valid React type.
Will try to statically convert props to a JS object. Falls back to $$
when
ambiguous.
Example:
($ MyComponent
"child1"
($ "span"
{:style {:color "green"}}
"child2" ))
Create a new React element from a valid React type. Will try to statically convert props to a JS object. Falls back to `$$` when ambiguous. Example: ``` ($ MyComponent "child1" ($ "span" {:style {:color "green"}} "child2" )) ```
($$ type & args)
Dynamically create a new React element from a valid React type.
$
can typically be faster, because it will statically process the arguments
at macro-time if possible.
Example:
($$ MyComponent
"child1"
($$ "span"
{:style {:color "green"}}
"child2" ))
Dynamically create a new React element from a valid React type. `$` can typically be faster, because it will statically process the arguments at macro-time if possible. Example: ``` ($$ MyComponent "child1" ($$ "span" {:style {:color "green"}} "child2" )) ```
(<> & children)
Creates a new React Fragment Element
Creates a new React Fragment Element
(defcomponent display-name & spec)
Defines a React class component.
Defines a React class component.
(defnc display-name & form-body)
Creates a new functional React component. Used like:
(defnc component-name "Optional docstring" [props ?ref] {,,,opts-map} ,,,body)
"component-name" will now be a React function component that returns a React Element.
Your component should adhere to the following:
First parameter is 'props', a map of properties passed to the component.
Second parameter is optional and is used with React.forwardRef
.
'opts-map' is optional and can be used to pass some configuration options to the macro. Current options:
'body' should return a React Element.
Creates a new functional React component. Used like: (defnc component-name "Optional docstring" [props ?ref] {,,,opts-map} ,,,body) "component-name" will now be a React function component that returns a React Element. Your component should adhere to the following: First parameter is 'props', a map of properties passed to the component. Second parameter is optional and is used with `React.forwardRef`. 'opts-map' is optional and can be used to pass some configuration options to the macro. Current options: - ':wrap' - ordered sequence of higher-order components to wrap the component in 'body' should return a React Element.
(factory type)
Creates a factory function for a React component
Creates a factory function for a React component
(-type factory)
Extracts the underlying type from the factory function.
Extracts the underlying type from the factory function.
(provider {:keys [context value] :as props} & children)
Creates a Provider for a React Context value.
Example:
(def my-context (react/createContext))
(provider {:context my-context :value my-value} child1 child2 ...childN)
Creates a Provider for a React Context value. Example: (def my-context (react/createContext)) (provider {:context my-context :value my-value} child1 child2 ...childN)
(register! type id)
Registers a component with the React Fresh runtime.
type
is the component function, and id
is the unique ID assigned to it
(e.g. component name) for cache invalidation.
Registers a component with the React Fresh runtime. `type` is the component function, and `id` is the unique ID assigned to it (e.g. component name) for cache invalidation.
(suspense {:keys [fallback]} & children)
Creates a React Suspense boundary.
Creates a React Suspense boundary.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close