react#ClassAttributes TypeScript Examples

The following examples show how to use react#ClassAttributes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: react-utils.ts    From utopia with MIT License 7 votes vote down vote up
// Utility function to interact with react. Provides the following advantages:
  // - forces the use of a key
  // - by having key and children as separate properties, the attrs param has the correct shape for the component model
  // - it's shorter than createElement :p

  // DOM Elements
  static create<P extends HTMLAttributes<T>, T extends HTMLElement>(
    type: keyof ReactHTML,
    props?: { key: Key } & ClassAttributes<T> & P,
    ...children: ReactNode[]
  ): DetailedReactHTMLElement<P, T>
Example #2
Source File: react-utils.ts    From utopia with MIT License 6 votes vote down vote up
static create<P extends SVGAttributes<T>, T extends SVGElement>(
    type: keyof ReactSVG,
    props?: { key: Key } & ClassAttributes<T> & P,
    ...children: ReactNode[]
  ): ReactSVGElement
Example #3
Source File: react-utils.ts    From utopia with MIT License 6 votes vote down vote up
static create<P extends DOMAttributes<T>, T extends HTMLElement>(
    type: string,
    props?: { key: Key } & ClassAttributes<T> & P,
    ...children: ReactNode[]
  ): DOMElement<P, T>
Example #4
Source File: react-utils.ts    From utopia with MIT License 6 votes vote down vote up
static create<P>(
    type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
    props?: { key: Key } & ClassAttributes<ClassicComponent<P, ComponentState>> & P,
    ...children: ReactNode[]
  ): CElement<P, ClassicComponent<P, ComponentState>>
Example #5
Source File: react-utils.ts    From utopia with MIT License 6 votes vote down vote up
static create<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
    type: ClassType<P, T, C>,
    props?: { key: Key } & ClassAttributes<T> & P,
    ...children: ReactNode[]
  ): CElement<P, T>