Getting Started


  • peerDependencies:

    feature-u has a peerDependency on react (most likely you should already have this installed ... but just in case):

    npm install --save react
  • the main event:

    npm install --save feature-u


All functions are exposed through UMD, and therefore accessible through any one of the following techniques ...

  • ES6 Import (Native JS)

    import { createFeature }  from 'feature-u';
    import * as FeatureU from 'feature-u';
    import FeatureU from 'feature-u';
  • CommonJS

    const { createFeature } = require('feature-u');
    const FeatureU = require('feature-u');
  • AMD

    define(['feature-u', 'otherModule'], function(FeatureU, otherModule) {
  • <script> tag

    <script src=""></script>

Potential Need for Polyfills

The implementation of this library employs modern es2015+ JavaScript constructs. Even though the library distribution is transpiled to es5 (the least common denominator), polyfills may be required if you are using an antiquated JavaScript engine (such as the IE browser).

We take the approach that polyfills are the responsibility of the client app. This is a legitimate approach, as specified by the W3C Polyfill Findings (specifically Advice for library authors).

  • polyfills should only be introduced one time (during code expansion of the app)
  • a library should not pollute the global name space (by including polyfills at the library level)
  • a library should not needlessly increase it's bundle size (by including polyfills that are unneeded in a majority of target environments)

As it turns out, app-level polyfills are not hard to implement, with the advent of third-party utilities, such as babel:

If your target JavaScript engine is inadequate, it will generate native run-time errors, and you will need to address the polyfills. Unfortunately, in many cases these errors can be very obscure (even to seasoned developers). The following Babel Feature Request (if/when implemented) is intended to address this issue.

results matching ""

    No results matching ""