Omit props HOC for React and React Native


1,787170.4.03 years ago4 years agoMinified + gzip package size for @hocs/omit-props in KB


:non-potable_water: 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.


yarn add @hocs/omit-props


  ...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')

:tv: Check out live demo.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.