# react-is-deprecated

> Adds an isDeprecated method to the React.PropTypes object

Latest version **0.1.2** (published 2016-03-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-is-deprecated
pnpm add react-is-deprecated
yarn add react-is-deprecated
bun add react-is-deprecated
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2016-03-29 |
| First published | 2016-03-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/react-is-deprecated) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 44 |
| Author | Brandon Dail |
| Maintainers | aweary |
| Keywords | react, propTypes, isDeprecated |

## Links

- npm: https://www.npmjs.com/package/react-is-deprecated
- Repository: https://www.github.com/Aweary/react-is-deprecated
- npm.io page: https://npm.io/package/react-is-deprecated

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2016-03-29
- 0.1.1 — 2016-03-29
- 0.1.0 — 2016-03-28
- 0.0.2 — 2016-03-28
- 0.0.1 — 2016-03-28

## README

# react-is-deprecated

> Add an `isDeprecated` to your React PropTypes.


## Install

```
$ npm install --save react-is-deprecated
```


## Usage

`react-is-deprecated` provides two options for wrapping `React.PropTypes`. You can use the `deprecate` function (recommended) to wrap a specific type and output a warning
whenever the prop is defined:

```js

static propTypes = {
  deprecated: deprecate(PropTypes.string, `Your message here`)
}

```

If you'd like to have an `isDeprecated` function attached to all `React.PropTypes` options you can use `addIsDeprecated`.

```js

const PropTypes = addIsDeprecated(React.PropTypes);
...
static propTypes = {
  deprecated: PropTypes.object.isDeprecated('Your message here.')
}

```

**Note: `addIsDeprecated` returns a copy of the passed `PropTypes` instance
and does not mutate the `React.PropTypes`. `isDeprecated` will only work on the PropType object returned.**


## API

### `deprecate(propType: React.PropTypes.[type], message: string)`
Returns a function wrapping the `propType` argument with a check to determine if the prop is defined and, if so, log out a warning via `console.warn` once.

### `addIsDeprecated(input: React.PropTypes)`

Returns an augmented version of `React.PropTypes` with `isDeprecated` added to all top level properties.

### `[type].isDeprecated(message: string)`
If you use the `addIsDeprecated` function to return a new copy of `React.PropTypes` then each type will have an `isDeprecated` message.
It is identical to `deprecate` with the exception that it is already
bound to the `[type]` and just accepts the message.

## License

MIT © Brandon Dail

---
_Source: https://npm.io/package/react-is-deprecated · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
