better-docs
better-docs copied to clipboard
Is it possible to map between Router and Component in document?
i consider use this library for my project. It's awesome library:)
when i develop react SPA with react router like below, i want to write document like capture image.
is it possible? and if it possible. could you give advice that how to make to me?
index.js
<Route path="/documented">
<Documented />
</Route>
Documented.js
import React from 'react'
import PropTypes from 'prop-types'
/**
* Some documented component
*
* @component
* @example
* const size = 12
* const text = 'I am documented!'
* return (
* <Documented size={size} text={text} />
* )
*/
const Documented = (props) => {
const { text, size } = props
return (
<p style={{ fontSize: size, padding: 10, border: '1px solid #ccc'}}>{text}</p>
)
}
Documented.propTypes = {
/**
* Text is a text :)
*/
text: PropTypes.string.isRequired,
/**
* Font size
*/
size: PropTypes.number,
}
Documented.defaultProps = {
text: 'Hello World',
size: 12,
}
export default Documented
Capture Image
