Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Connect<StateProps, FunctionProps, OwnProps>

Type parameters

  • StateProps

  • FunctionProps

  • OwnProps

Hierarchy

  • Component<IConnectProps<StateProps, FunctionProps, OwnProps>>
    • Connect

Index

Constructors

constructor

  • new Connect<StateProps, FunctionProps, OwnProps>(props: IConnectProps<StateProps, FunctionProps, OwnProps>): Connect<StateProps, FunctionProps, OwnProps>

Properties

context

context: any

If using the new style context, re-declare this in your class to be the React.ContextType of your static contextType. Should be used with type annotation or static contextType.

static contextType = MyContext
// For TS pre-3.7:
context!: React.ContextType<typeof MyContext>
// For TS 3.7 and above:
declare context: React.ContextType<typeof MyContext>
see

https://reactjs.org/docs/context.html

Readonly props

props: Readonly<P> & Readonly<{ children?: ReactNode }>

refs

refs: {}

Type declaration

  • [key: string]: ReactInstance

state

state: Readonly<S>

Optional Static contextType

contextType: Context<any>

If set, this.context will be set at runtime to the current value of the given Context.

Usage:

type MyContext = number
const Ctx = React.createContext<MyContext>(0)

class Foo extends React.Component {
  static contextType = Ctx
  context!: React.ContextType<typeof Ctx>
  render () {
    return <>My context's value: {this.context}</>;
  }
}
see

https://reactjs.org/docs/context.html#classcontexttype

Methods

Optional UNSAFE_componentWillMount

UNSAFE_componentWillMount:

Optional UNSAFE_componentWillReceiveProps

UNSAFE_componentWillReceiveProps:

Optional UNSAFE_componentWillUpdate

UNSAFE_componentWillUpdate:

Optional componentDidCatch

componentDidCatch:

Optional componentDidMount

componentDidMount:

Optional componentDidUpdate

componentDidUpdate:

Optional componentWillMount

componentWillMount:

Optional componentWillReceiveProps

componentWillReceiveProps:

Optional componentWillUnmount

componentWillUnmount:

Optional componentWillUpdate

componentWillUpdate:

forceUpdate

  • forceUpdate(callback?: () => void): void
  • Parameters

    • Optional callback: () => void
        • (): void
        • Returns void

    Returns void

Optional getSnapshotBeforeUpdate

getSnapshotBeforeUpdate:

render

  • render(): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>
  • Returns DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>

setState

  • setState<K>(state: null | {} | ((prevState: Readonly<{}>, props: Readonly<IConnectProps<StateProps, FunctionProps, OwnProps>>) => null | {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void
  • Type parameters

    • K: never

    Parameters

    • state: null | {} | ((prevState: Readonly<{}>, props: Readonly<IConnectProps<StateProps, FunctionProps, OwnProps>>) => null | {} | Pick<{}, K>) | Pick<{}, K>
    • Optional callback: () => void
        • (): void
        • Returns void

    Returns void

shouldComponentUpdate

  • shouldComponentUpdate(nextProps: IConnectProps<StateProps, FunctionProps, OwnProps>): boolean

Generated using TypeDoc