Home / Function/ createInstance() — react Function Reference

createInstance() — react Function Reference

Architecture documentation for the createInstance() function in ReactFiberConfigART.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  22c6bdbb_54de_6b34_4e35_95ce98fb1778["createInstance()"]
  18cde195_5800_e07a_4f5e_1af7f71a810d["ReactFiberConfigART.js"]
  22c6bdbb_54de_6b34_4e35_95ce98fb1778 -->|defined in| 18cde195_5800_e07a_4f5e_1af7f71a810d
  style 22c6bdbb_54de_6b34_4e35_95ce98fb1778 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-art/src/ReactFiberConfigART.js lines 269–303

export function createInstance(type, props, internalInstanceHandle) {
  let instance;

  switch (type) {
    case TYPES.CLIPPING_RECTANGLE:
      instance = Mode.ClippingRectangle();
      instance._applyProps = applyClippingRectangleProps;
      break;
    case TYPES.GROUP:
      instance = Mode.Group();
      instance._applyProps = applyGroupProps;
      break;
    case TYPES.SHAPE:
      instance = Mode.Shape();
      instance._applyProps = applyShapeProps;
      break;
    case TYPES.TEXT:
      instance = Mode.Text(
        props.children,
        props.font,
        props.alignment,
        props.path,
      );
      instance._applyProps = applyTextProps;
      break;
  }

  if (!instance) {
    throw new Error(`ReactART does not support the type "${type}"`);
  }

  instance._applyProps(instance, props);

  return instance;
}

Domain

Subdomains

Frequently Asked Questions

What does createInstance() do?
createInstance() is a function in the react codebase, defined in packages/react-art/src/ReactFiberConfigART.js.
Where is createInstance() defined?
createInstance() is defined in packages/react-art/src/ReactFiberConfigART.js at line 269.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free