How to use the inferno.normalizeProps function in inferno

To help you get started, we’ve selected a few inferno examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github infernojs / inferno / packages / inferno-compat / src / index.ts View on Github external
props = vNode.props = {};
  }

  // React supports iterable children, in addition to Array-like
  if (hasSymbolSupport && !isNull(children) && typeof children === 'object' && !isArray(children) && isFunction(children[symbolIterator])) {
    vNode.children = iterableToArray(children[symbolIterator]());
  }

  if (!isNullOrUndef(children) && isNullOrUndef(props.children)) {
    props.children = children;
  }
  if (vNode.flags & VNodeFlags.Component) {
    if (isString(vNode.type)) {
      vNode.flags = getFlagsForElementVnode(vNode.type as string);
      if (props) {
        normalizeProps(vNode);
      }
    }
  }

  const flags = vNode.flags;

  if (flags & VNodeFlags.FormElement) {
    normalizeFormProps(vNode.type, props);
  }
  if (flags & VNodeFlags.Element) {
    if (vNode.className) {
      props.className = vNode.className;
    }
    normalizeGenericProps(props);
  }
github infernojs / inferno / packages / inferno-redux / src / components / connectAdvanced.ts View on Github external
public render() {
        const selector = this.selector;
        selector.shouldComponentUpdate = false;

        if (selector.error) {
          throw selector.error;
        } else {
          return normalizeProps(
            createComponentVNode(
              VNodeFlags.ComponentUnknown,
              WrappedComponent,
              this.addExtraProps(selector.props),
              null,
              withRef ? this.setWrappedInstance : null
            )
          );
        }
      }
    }
github infernojs / inferno / packages / inferno-clone-vnode / src / index.ts View on Github external
props.children = children;

  if (flags & VNodeFlags.Component) {
    return createComponentVNode(flags, vNodeToClone.type, !vNodeToClone.props && !props ? EMPTY_OBJ : combineFrom(vNodeToClone.props, props), key, ref);
  }

  if (flags & VNodeFlags.Text) {
    return createTextVNode(children);
  }

  if (flags & VNodeFlags.Fragment) {
    return createFragment(childLen === 1 ? [children] : children, ChildFlags.UnknownChildren, key);
  }

  return normalizeProps(
    createVNode(flags, vNodeToClone.type, className, null, ChildFlags.HasInvalidChildren, combineFrom(vNodeToClone.props, props), key, ref)
  );
}