https://github.com/thefrontside/deprecated-prop-type
Communicate to the consumers of your component that the marked prop is deprecated.
https://github.com/thefrontside/deprecated-prop-type
Last synced: about 1 year ago
JSON representation
Communicate to the consumers of your component that the marked prop is deprecated.
- Host: GitHub
- URL: https://github.com/thefrontside/deprecated-prop-type
- Owner: thefrontside
- Created: 2018-07-18T19:01:19.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T15:16:22.000Z (over 3 years ago)
- Last Synced: 2025-03-27T13:12:44.214Z (over 1 year ago)
- Language: JavaScript
- Size: 854 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# deprecated-prop-type
`deprecated` prop type communicates to the developer that the marked prop should not be used.
## Installation
```bash
yarn add deprecated-prop-type
#
npm i deprecated-prop-type
```
## Usage
`deprecated` prop type takes two arguments: original prop type and reason for the deprecation. It will not show the warning if the original prop type failes.
```jsx
import React from 'react';
import propTypes from 'prop-types';
import deprecated from 'deprecated-prop-type';
export default class MyComponent extends React.Component {
static propTypes = {
excludeDates: deprecated(propTypes.string, `Use excluded instead.`)
}
...
}
```
## Tests
```bash
npm install;
npm test
```
## Credits
The code was taken from https://reactjs.org/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes