Skip to content

reconnect

Action for reconnecting connectors.

Import

ts
import { reconnect } from '@wagmi/core'
import { reconnect } from '@wagmi/core'

Usage

ts
import { reconnect } from '@wagmi/core'
import { injected } from '@wagmi/connectors'
import { config } from './config'

const result = await reconnect(config, { connectors: [injected()] })
import { reconnect } from '@wagmi/core'
import { injected } from '@wagmi/connectors'
import { config } from './config'

const result = await reconnect(config, { connectors: [injected()] })
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})

Parameters

ts
import { type ReconnectParameters } from '@wagmi/core'
import { type ReconnectParameters } from '@wagmi/core'

connectors

(CreateConnectorFn | Connector)[] | undefined

ts
import { reconnect } from '@wagmi/core'
import { injected } from '@wagmi/connectors'
import { config } from './config'

const result = await reconnect(config, {
    connectors: [injected()], 
})
import { reconnect } from '@wagmi/core'
import { injected } from '@wagmi/connectors'
import { config } from './config'

const result = await reconnect(config, {
    connectors: [injected()], 
})
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})

Return Type

ts
import { type ReconnectReturnType } from '@wagmi/core'
import { type ReconnectReturnType } from '@wagmi/core'

Connection[]

Connections that were successfully reconnected.

Error

ts
import { type ReconnectErrorType } from '@wagmi/core'
import { type ReconnectErrorType } from '@wagmi/core'

TanStack Query

ts
import {
  type ReconnectData,
  type ReconnectVariables,
  type ReconnectMutate,
  type ReconnectMutateAsync,
  reconnectMutationOptions,
} from '@wagmi/core/query'
import {
  type ReconnectData,
  type ReconnectVariables,
  type ReconnectMutate,
  type ReconnectMutateAsync,
  reconnectMutationOptions,
} from '@wagmi/core/query'

Released under the MIT License.