How do you document React functional components using TypeDoc?

1.3k views Asked by At

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.

0

There are 0 answers