Documentation
Preparing search index...
@rivetkit/react
createRivetKit
Function createRivetKit
createRivetKit
<
Registry
extends
AnyActorRegistry
>
(
clientInput
:
|
string
|
{
disableMetadataLookup
?:
boolean
;
encoding
?:
"json"
|
"cbor"
|
"bare"
;
endpoint
?:
string
;
getUpgradeWebSocket
?:
GetUpgradeWebSocket
;
headers
?:
Record
<
string
,
string
>
;
namespace
?:
string
;
runnerName
?:
string
;
token
?:
string
;
}
|
undefined
,
opts
?:
CreateRivetKitOptions
<
Registry
>
,
)
:
{
useActor
:
<
ActorName
extends
string
|
number
|
symbol
>
(
opts
:
ActorOptions
<
Registry
,
ActorName
>
,
)
=>
{
connection
:
|
ActorConn
<
ExtractActorsFromRegistry
<
Registry
>
[
ActorName
]
>
|
null
;
error
:
Error
|
null
;
handle
:
ActorHandle
<
ExtractActorsFromRegistry
<
Registry
>
[
ActorName
]
>
|
null
;
hash
:
string
;
isConnected
?:
boolean
;
isConnecting
?:
boolean
;
isError
?:
boolean
;
opts
:
{
createInRegion
?:
string
;
createWithInput
?:
unknown
;
enabled
?:
boolean
;
key
:
string
|
string
[]
;
name
:
keyof
ExtractActorsFromRegistry
<
Registry
>
;
params
?:
Record
<
string
,
string
>
;
}
;
useEvent
:
(
eventName
:
string
,
handler
:
(
...
args
:
any
[]
)
=>
void
)
=>
void
;
}
;
}
Type Parameters
Registry
extends
AnyActorRegistry
Parameters
clientInput
:
|
string
|
{
disableMetadataLookup
?:
boolean
;
encoding
?:
"json"
|
"cbor"
|
"bare"
;
endpoint
?:
string
;
getUpgradeWebSocket
?:
GetUpgradeWebSocket
;
headers
?:
Record
<
string
,
string
>
;
namespace
?:
string
;
runnerName
?:
string
;
token
?:
string
;
}
|
undefined
opts
:
CreateRivetKitOptions
<
Registry
>
= {}
Returns
{
useActor
:
<
ActorName
extends
string
|
number
|
symbol
>
(
opts
:
ActorOptions
<
Registry
,
ActorName
>
,
)
=>
{
connection
:
|
ActorConn
<
ExtractActorsFromRegistry
<
Registry
>
[
ActorName
]
>
|
null
;
error
:
Error
|
null
;
handle
:
ActorHandle
<
ExtractActorsFromRegistry
<
Registry
>
[
ActorName
]
>
|
null
;
hash
:
string
;
isConnected
?:
boolean
;
isConnecting
?:
boolean
;
isError
?:
boolean
;
opts
:
{
createInRegion
?:
string
;
createWithInput
?:
unknown
;
enabled
?:
boolean
;
key
:
string
|
string
[]
;
name
:
keyof
ExtractActorsFromRegistry
<
Registry
>
;
params
?:
Record
<
string
,
string
>
;
}
;
useEvent
:
(
eventName
:
string
,
handler
:
(
...
args
:
any
[]
)
=>
void
)
=>
void
;
}
;
}
useActor
:
<
ActorName
extends
string
|
number
|
symbol
>
(
opts
:
ActorOptions
<
Registry
,
ActorName
>
,
)
=>
{
connection
:
|
ActorConn
<
ExtractActorsFromRegistry
<
Registry
>
[
ActorName
]
>
|
null
;
error
:
Error
|
null
;
handle
:
ActorHandle
<
ExtractActorsFromRegistry
<
Registry
>
[
ActorName
]
>
|
null
;
hash
:
string
;
isConnected
?:
boolean
;
isConnecting
?:
boolean
;
isError
?:
boolean
;
opts
:
{
createInRegion
?:
string
;
createWithInput
?:
unknown
;
enabled
?:
boolean
;
key
:
string
|
string
[]
;
name
:
keyof
ExtractActorsFromRegistry
<
Registry
>
;
params
?:
Record
<
string
,
string
>
;
}
;
useEvent
:
(
eventName
:
string
,
handler
:
(
...
args
:
any
[]
)
=>
void
)
=>
void
;
}
Settings
Member Visibility
Protected
Inherited
Theme
OS
Light
Dark
Documentation
Loading...