React DOM Property Configuration

2.0.2 · active · verified Sun Apr 19

react-property is a utility package that exposes the internal HTML and SVG DOM property configurations used by React. It provides programmatic access to React's understanding of DOM properties, including their type (e.g., boolean, numeric, string), and a mapping of non-standard attribute names to their standard counterparts (e.g., `accept-charset` to `acceptCharset`). The package is currently stable at version 2.0.2 and appears to have an infrequent release cadence, primarily updating to align with significant changes in React's DOM handling, as seen with its v2.0.0 release. Its key differentiator is providing a direct mirror of React's internal DOM property logic, which can be useful for tools, linting, or custom renderers that need to replicate React's attribute normalization and property handling without relying on the full React DOM package.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates importing the default export and using its `getPropertyInfo`, `isCustomAttribute`, and `possibleStandardNames` utilities, along with accessing its property type constants.

import reactProperty from 'react-property';

// Get information about a specific HTML property
const acceptCharsetInfo = reactProperty.getPropertyInfo('acceptCharset');
console.log('acceptCharset info:', acceptCharsetInfo); // Example: { type: 1, 'alias for': 'accept-charset' }

// Check if an attribute is a custom attribute
const isDataAttr = reactProperty.isCustomAttribute('data-my-custom-attr');
console.log('Is data-my-custom-attr custom?', isDataAttr); // true

// Get standard name for a non-standard attribute
const standardName = reactProperty.possibleStandardNames['accept-charset'];
console.log('Standard name for accept-charset:', standardName); // acceptCharset

// Access property types constants
console.log('BOOLEAN property type:', reactProperty.BOOLEAN);
console.log('STRING property type:', reactProperty.STRING);

view raw JSON →