JSPM

@hocs/omit-props

0.4.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 70
  • Score
    100M100P100Q81717F
  • License

Omit props HOC for React and React Native

Package Exports

  • @hocs/omit-props

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hocs/omit-props) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

🚱 omit-props

npm ci coverage deps

Part of a collection of Higher-Order Components for React, especially useful with Recompose.

Helps to omit unnecessary context prop, state setters or anything else you don't want to propagate and {...spread} to Component.

Install

yarn add @hocs/omit-props

Usage

omitProps(
  ...props: Array<string>
): HigherOrderComponent
import React from 'react';
import { compose, withProps } from 'recompose';
import omitProps from '@hocs/omit-props';

const Demo = (props) => (
  <h1>props: {JSON.stringify(props)}</h1>
  // props: {"c":3}
);

export default compose(
  withProps({ a: 1, b: 2, c: 3 }),
  omitProps('a', 'b')
)(Demo);

📺 Check out live demo.