Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
583 views
in Technique[技术] by (71.8m points)

reactjs - How do you document React functional components using TypeDoc?

I am learning through the React functional components and using TypeDoc to generate some documentation (maybe I shouldn't be using that). Anyway I want to somehow get a list of states (or even states used) in the documentation that is generates without repeating myself in the top part of the function.

I don't think it is possible from looking at the code I have written since it's basically inner comments rather than something exposed.

/**
 * I don't want to document whatever states here...
 */
const AuthProvider = ({ children }: { children: React.ReactChild }) => {
  /**
   * OAuth token.
   */
  const [authToken, setAuthToken] = useState<OAuthToken | null>(null);

  /**
   * This state contains the AxiosResponse for the error or null.
   */
  const [authError, setAuthError] = useState<AxiosResponse | null>(null);

What I am hoping for is some sort of documentation like

AuthProvider

I don't want to document whatever states here...

State Hooks

  • authToken (mutator setAuthToken() )

    OAuth token

  • authError (mutator setAuthError() )

    This state contains the AxiosResponse for the error or null.

question from:https://stackoverflow.com/questions/65850029/how-do-you-document-react-functional-components-using-typedoc

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...