Skip to content

smooth-code/prop-desc

Repository files navigation

prop-desc

Licensenpm packageBuild StatusDevDependencies

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

Example

importReactfrom'react'importPropTypesfrom'prop-desc'functionMyComponent(){// ... do things with the props}MyComponent.propTypes={optionalArray: PropTypes.array,optionalBool: PropTypes.bool,optionalFunc: PropTypes.func,}console.log(PropTypes.getMetadata(MyComponent.propTypes))

Why?

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.

License

MIT

About

React prop-types with metadata inside ✨

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •