0.2.1 • Published 7 years ago

pure-stamp v0.2.1

Weekly downloads
55
License
MIT
Repository
github
Last release
7 years ago

pure-stamp

Creates an optimized pure compose function with dependencies tacked onto it for easy lib propagation.

Build Status codecov

NPM

Install

npm install -S pure-stamp

Usage

import React from 'react'
import shallowCompare from 'react-addons-shallow-compare'
import pureStamp from 'pure-stamp'

const pure = pureStamp({ React, shallowCompare[, other[, libs ]] }[, defaults = {}])

/** Wraps commonly required dependencies for passing around a lib and optional defaults object for propagating configuration. */
const { React, PropTypes, cloneElement, other, libs, defaults } = pure

/** PureStamp is a React component with shouldComponentUpdate implemented (shallowCompare). */
const PureComponent = pure (...desc?: Stamp|ReactDesc|SpecDesc[])


/** Need to stop shouldComponentUpdate for a minute? */
const ImpureComponent = pure.impure (...desc?: Stamp|ReactDesc|SpecDesc[])

See react-stamp documentation on compose for usage.