op
@hocs/omit-props
npm i @hocs/omit-props
op

@hocs/omit-props

🍱 Higher-Order Components for React

by Kir Belevich

0.4.0 (see all)License:{"type":"MIT","url":"https://github.com/deepsweet/hocs/blob/master/license.md"}TypeScript:Not Found
npm i @hocs/omit-props
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.

Downloads/wk

401

GitHub Stars

1.8K

LAST COMMIT

3yrs ago

MAINTAINERS

1

CONTRIBUTORS

4

OPEN ISSUES

4

OPEN PRs

16
VersionTagPublished
0.4.0
latest
4yrs ago
No alternatives found
No tutorials found
Add a tutorial