@nozbe/watermelondb
Version:
Build powerful React Native and React web apps that scale from hundreds to tens of thousands of records and remain fast
21 lines (16 loc) • 638 B
JavaScript
// @flow
import { createElement } from 'react'
export type HOC<Base, Enhanced> = (React$ComponentType<Base>) => React$ComponentType<Enhanced>
let _createFactory: any = (Component) => {
// eslint-disable-next-line react/function-component-definition, react/display-name
return (props) => createElement(Component, props)
}
// undocumented binding for NT perf hack
export function _setCreateFactory(newCreateFactory: any): void {
_createFactory = newCreateFactory
}
export function createFactory<ElementType: React$ElementType>(
Component: ElementType,
): React$ElementFactory<ElementType> {
return _createFactory(Component)
}