import type { ReactNode } from '../core'
type SetStateCallback =
| Partial
| ((prev: S, props: P) => Partial | null)
| null
export class Component
{
static contextType?: any
static getDerivedStateFromProps?(props: any, state: any): any
static getDerivedStateFromError?(error: any): any
static defaultProps?: any
static displayName?: string
props: P
state: S = {} as S
context: any
refs: Record extends Component {}
;(PureComponent.prototype as any).isPureReactComponent = true
, cb?: () => void) => void) | null = null
_forceUpdate: ((cb?: () => void) => void) | null = null
constructor(props: P, context?: any) {
this.props = props
this.context = context
}
setState(updater: SetStateCallback, callback?: () => void): void {
if (!this._enqueueUpdate) {
if (process.env.NODE_ENV !== 'production') {
throw new Error('Cannot call setState on an um component.')
}
throw new Error()
}
this._enqueueUpdate(updater, callback)
}
forceUpdate(callback?: () => void): void {
if (!this._forceUpdate) return
this._forceUpdate(callback)
}
render(): ReactNode {
if (process.env.NODE_ENV !== 'production') {
throw new Error('Component subclass must implement render().')
}
throw new Error()
}
componentDidMount?(): void
componentDidUpdate?(prevProps: P, prevState: S, snapshot?: any): void
componentWillUnmount?(): void
shouldComponentUpdate?(nextProps: P, nextState: S, nextCtx: any): boolean
getSnapshotBeforeUpdate?(prevProps: P, prevState: S): any
componentDidCatch?(error: any, info: { componentStack: string }): void
}
;(Component.prototype as any).isReactComponent = {}
export class PureComponent