Function: useMainThreadRef()
Call Signature
useMainThreadRef<
T>(initValue:T):MainThreadRef<T>
Create A MainThreadRef.
A MainThreadRef is a ref that can only be accessed on the main thread. It is used to preserve
states between main thread function calls.
The data saved in current property of the MainThreadRef can be read and written in
multiple main thread functions.
It is a hook and it should only be called at the top level of your component.
Type Parameters
Parameters
Returns
Example
Call Signature
useMainThreadRef<
T>(initValue:T|null):RefObject<T>
Create A MainThreadRef.
A MainThreadRef is a ref that can only be accessed on the main thread. It is used to preserve
states between main thread function calls.
The data saved in current property of the MainThreadRef can be read and written in
multiple main thread functions.
It is a hook and it should only be called at the top level of your component.
Type Parameters
Parameters
Returns
RefObject<T>
Example
Call Signature
useMainThreadRef<
T=undefined>():MainThreadRef<T|undefined>
Create A MainThreadRef.
A MainThreadRef is a ref that can only be accessed on the main thread. It is used to preserve
states between main thread function calls.
The data saved in current property of the MainThreadRef can be read and written in
multiple main thread functions.
It is a hook and it should only be called at the top level of your component.
Type Parameters
Returns
MainThreadRef<T | undefined>