Skip to content

Module: react

React APIs

npm install @self.id/react

Classes

Type aliases

ProviderConfig

Ƭ ProviderConfig<ModelTypes>: Object

Type parameters

Name Type
ModelTypes extends ModelTypeAliases = CoreModelTypes

Type declaration

Name Type
client? WebClientParams<ModelTypes>
queryOptions? QueryObserverOptions
state? RequestState

ProviderProps

Ƭ ProviderProps<ModelTypes>: ProviderConfig<ModelTypes> & { children: ReactNode }

Type parameters

Name Type
ModelTypes extends ModelTypeAliases = CoreModelTypes

PublicRecord

Ƭ PublicRecord<ContentType>: Object

Type parameters

Name
ContentType

Type declaration

Name Type
content? ContentType
error? unknown
isError boolean
isLoading boolean

RequestClientParams

Ƭ RequestClientParams<ModelTypes>: CoreParams<ModelTypes> & { cookie?: string }

Type parameters

Name Type
ModelTypes extends ModelTypeAliases = CoreModelTypes

RequestState

Ƭ RequestState: Object

Type declaration

Name Type
hydrate? DehydratedState
viewerID? string | null

ViewerConnectedContainerProps

Ƭ ViewerConnectedContainerProps: Object

Type declaration

Name Type
children ReactNode
renderFallback? (connectionState: ViewerConnectionState<ModelTypes>) => null | Element

ViewerConnectionState

Ƭ ViewerConnectionState<ModelTypes>: { status: "idle" } | { promise: Abortable<SelfID<ModelTypes> | null> ; provider: EthereumAuthProvider ; status: "connecting" } | { selfID: SelfID<ModelTypes> ; status: "connected" } | { error: Error ; status: "failed" }

Type parameters

Name Type
ModelTypes extends ModelTypeAliases = CoreModelTypes

ViewerID

Ƭ ViewerID<ModelTypes>: PublicID<ModelTypes> | SelfID<ModelTypes>

Type parameters

Name Type
ModelTypes extends ModelTypeAliases

ViewerRecord

Ƭ ViewerRecord<ContentType>: { content?: never ; error?: never ; isError: false ; isLoadable: false ; isLoading: false ; isMutable: false ; isMutating: false ; merge?: never ; set?: never } | { content?: ContentType ; error?: unknown ; isError: boolean ; isLoadable: true ; isLoading: boolean ; isMutable: boolean ; isMutating: boolean ; merge: (content: ContentType) => Promise<void> ; set: (content: ContentType) => Promise<void> }

Type parameters

Name
ContentType

Functions

Provider

Provider<ModelTypes>(props): JSX.Element

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes

Parameters

Name Type
props ProviderProps<ModelTypes>

Returns

JSX.Element


ViewerConnectedContainer

ViewerConnectedContainer(props): JSX.Element | null

Parameters

Name Type
props ViewerConnectedContainerProps

Returns

JSX.Element | null


getCookieViewerID

getCookieViewerID(cookie?): string | null

Parameters

Name Type
cookie? string

Returns

string | null


useCore

useCore<ModelTypes>(): Core<ModelTypes>

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes

Returns

Core<ModelTypes>


usePublicRecord

usePublicRecord<ModelTypes, Alias, ContentType>(alias, id): PublicRecord<ContentType | null>

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes
Alias extends string | number | symbol = keyof ModelTypes["definitions"]
ContentType DefinitionContentType<ModelTypes, Alias>

Parameters

Name Type
alias Alias
id string

Returns

PublicRecord<ContentType | null>


useViewerConnection

useViewerConnection<ModelTypes>(): [ViewerConnectionState, (provider: EthereumAuthProvider) => Promise<SelfID<ModelTypes> | null>, () => void]

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes

Returns

[ViewerConnectionState, (provider: EthereumAuthProvider) => Promise<SelfID<ModelTypes> | null>, () => void]


useViewerID

useViewerID<ModelTypes>(): ViewerID<ModelTypes> | null

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes

Returns

ViewerID<ModelTypes> | null


useViewerRecord

useViewerRecord<ModelTypes, Alias, ContentType>(alias): ViewerRecord<ContentType | null>

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes
Alias extends string | number | symbol = keyof ModelTypes["definitions"]
ContentType DefinitionContentType<ModelTypes, Alias>

Parameters

Name Type
alias Alias

Returns

ViewerRecord<ContentType | null>