isRef
Overview
Section titled “Overview”The isRef
function determines whether a given value is a ref object, indicating that it has been converted into a ref using the ref
, sref
or computed
functions.
Checking for Ref
Section titled “Checking for Ref”To check if a value is a ref, you can use the isRef
function.
import { isRef } from 'regor'
const myValue = /* Your value here */
if (isRef(myValue)) { console.log('The value is a ref.')} else { console.log('The value is not a ref.')}
Parameters
Section titled “Parameters”value
: The value you want to check for being a ref object.
Return Value
Section titled “Return Value”- The
isRef
function returnstrue
if the providedvalue
is a ref object, andfalse
otherwise.
Example
Section titled “Example”import { isRef } from 'regor'
const refValue = /* A ref value created using the ref or sref function */
if (isRef(refValue)) { console.log('This value is a ref object.')} else { console.log('This value is not a ref object.')}