react / useMainThreadRef
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 Parameter |
---|
T |
Parameter | Type | Description |
---|---|---|
initValue |
T |
The init value of the MainThreadRef . |
@lynx-js/react/runtime/lib/worklet/workletRef.d.ts:54
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 Parameter |
---|
T |
Parameter | Type | Description |
---|---|---|
initValue |
null | T |
The init value of the MainThreadRef . |
RefObject
<T
>
@lynx-js/react/runtime/lib/worklet/workletRef.d.ts:93
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 Parameter | Default type |
---|---|
T |
undefined |
MainThreadRef
<T
| undefined
>
@lynx-js/react/runtime/lib/worklet/workletRef.d.ts:130