All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.react.setRef.kt Maven / Gradle / Ivy

package react

/**
 * [Original](https://github.com/mui/material-ui/blob/f0f33c6038f874d2f3ecc251a8ca5bc640424992/packages/mui-utils/src/setRef.ts#L16
 */
fun  setRef(
    ref: Ref?,
    value: T?,
) {
    ref ?: return

    if (ref is Function<*>) {
        ref.asDynamic()(value)
    } else {
        val refObject = ref.unsafeCast>()
        refObject.current = value
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy