0.2.2 • Published 7 years ago
omit-props v0.2.2
omit-props
"Omit props" Higher-Order Component (HOC) for React, especially useful with Recompose to omit state setters, context or anything else you don't want to propagate to a component.
Install
yarn add recompose omit-props
Usage
import React from 'react';
import { compose, withProps } from 'recompose';
import omitProps from '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);
Development
yarn start