How to use the react-dom-factories.hasOwnProperty function in react-dom-factories

To help you get started, we’ve selected a few react-dom-factories 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 idyll-lang / idyll / packages / idyll-document / src / utils / schema2element.js View on Github external
const [name, ...subs] = schema.component.split('.');

    // find the def in the provided map
    if (componentMap) {
      Component = componentMap[name];
      if (!Component) Component = componentMap[paramCase(name)];
      if (!Component) Component = componentMap[pascalCase(name)];

      for (let i = 0; i < subs.length; i++) {
        Component = Component[subs[i]];
      }
    }

    // if still nothing found it's a native DOM component or an error
    if (!Component) {
      if (DOM.hasOwnProperty(name)) {
        Component = schema.component;
      } else {
        console.warn(
          `Could not find an implementation for: ${schema.component}`
        );
        return () => (
          <div style="{{">
            <pre>Could not find an implementation for: {schema.component}</pre>
          </div>
        );
      }
    }

    // if there is a default prop (CommonJS) return that
    return Component.default || Component;
  }
github uber / r-dom / index.js View on Github external
'use strict';
var React = require('react');
var classSet = require('classnames');
var omit = require('just-omit');
var ReactDOM = require('react-dom-factories');

module.exports = r;

// Export the React.DOM html tags
for (var domTag in ReactDOM) {
  if (ReactDOM.hasOwnProperty(domTag)) {
    r[domTag] = createTagFn(domTag);
  }
}

function r(component, properties, children) {
  // A properties object is optional so shift arguments if missing
  if (!children && isChildren(properties)) {
    children = properties;
    properties = {};
  }

  properties = properties || {};

  if (properties.hasOwnProperty('isRendered') && !properties.isRendered) {
    // React skips the component rendering if render() returns null.
    return null;
github TechniqueSoftware / react-json-schema / lib / ReactJsonSchema.js View on Github external
resolveComponent(schema) {
    const componentMap = this.getComponentMap();
    let Component = null;
    if (schema.hasOwnProperty('component')) {
      if (schema.component === Object(schema.component)) {
        Component = schema.component;
      } else if (componentMap && componentMap[schema.component]) {
        Component = componentMap[schema.component];
      } else if (DOM.hasOwnProperty(schema.component)) {
        Component = schema.component;
      }
    } else {
      throw new Error(`ReactJsonSchema could not resolve a component due to a missing component 
          attribute in the schema.`);
    }
    return Component;
  }