# react-props-check

> Validate React properties to keep the DOM semantic.

Latest version **1.1.4** (published 2024-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-props-check
pnpm add react-props-check
yarn add react-props-check
bun add react-props-check
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2024-12-06 |
| First published | 2023-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 33.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com> |
| Maintainers | mountain-ui |
| Keywords | attributes, components, properties, react component, react, typescript |

## Links

- npm: https://www.npmjs.com/package/react-props-check
- Repository: https://github.com/tonyghiani/mnt
- Homepage: https://github.com/tonyghiani/mnt/tree/main/packages/react-props-check#readme
- npm.io page: https://npm.io/package/react-props-check

## 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

- 1.1.4 (latest) — 2024-12-06
- 1.1.3 — 2024-01-19
- 1.1.2 — 2023-11-20
- 1.1.1 — 2023-11-20
- 1.1.0 — 2023-11-07

## README

# react-props-check

[![CI Status](https://img.shields.io/github/actions/workflow/status/tonyghiani/mnt/release.yml?style=for-the-badge&logo=github)](https://github.com/tonyghiani/mnt/actions)
[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](https://github.com/tonyghiani/mnt/blob/main/LICENSE)

`react-props-check` is a lightweight utility library designed to simplify prop validation in React applications. When working with React components, it's essential to ensure that your components receive the correct props to prevent unexpected issues during runtime. This package streamlines the process of validating React component props, helping you maintain code quality and reliability.

## Installation

You can install `react-props-check` via npm or yarn. Make sure you have Node.js and npm (or yarn) installed in your project before proceeding.

### Using npm

```bash
npm install react-props-check
```

### Using yarn

```bash
yarn add react-props-check
```

Once the package is installed, you can import it into your React application and start using it to validate props.

## Usage

`react-props-check` provides a simple and effective way to validate React component props. You can use it to check if a prop is one of the accepted properties defined in your application. Here's a basic example:

```javascript
import isValidProp from 'react-props-check';

const isValid = isValidProp('className'); // Check if 'className' is a valid React prop

if (isValid) {
  // Prop is valid, proceed with your logic
} else {
  // Prop is not valid, handle the error
}
```

## API Reference

### `isValidProp(property: ReactAcceptedProp | DataAttribute): boolean`

- `property` (ReactAcceptedProp | DataAttribute): The prop or data attribute to validate.

Returns `true` if the property is valid, `false` otherwise.

### DataAttribute

- `DataAttribute` is a string type representing data attributes in the format `data-{string}`.

### ReactAcceptedProp

- `ReactAcceptedProp` is an exported type that represents valid React props.

```javascript
import { ReactAcceptedProp } from 'react-props-check';
```

## License

This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/tonyghiani/mnt/blob/main/LICENSE) file for details. You are free to use and distribute this package under the terms of the MIT License.

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