A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/smooth-code/prop-desc below:

smooth-code/prop-desc: React prop-types with metadata inside ✨

React prop-types with metadata inside ✨

It is a drop-in replacement for prop-types that includes metadata to generate documentation from prop-types consistently.

npm install prop-desc prop-types
import React from 'react'
import PropTypes from 'prop-desc'

function MyComponent() {
  // ... do things with the props
}

MyComponent.propTypes = {
  optionalArray: PropTypes.array,
  optionalBool: PropTypes.bool,
  optionalFunc: PropTypes.func,
}

console.log(PropTypes.getMetadata(MyComponent.propTypes))

Generating documentation from prop types is useful but not easy. A project call react-docgen try to introspect code to extract type but it remains static and does not work with complex prop types (in other files). prop-desc solves this and permits to generate consistent documentation from your prop-types.

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4