Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSDoc: How to set @param for React element as a function param?

What should I add in the JSDoc @param block in the example below for my IntelliJ Webstorm IDE to stop throwing the error: Argument Type ComponentClass<undefined> is not assignable to parameter type ??? ... `?

/**
 * Renders the passed component into a div
 * @param { ??? } component // Question: <<<
 */
const myRenderFunc = (component) => (
  <div>{component}</div>
)
like image 858
clodal Avatar asked Sep 13 '25 21:09

clodal


1 Answers

Your React component @param type should be {ReactElement}

like image 184
andr1o Avatar answered Sep 16 '25 13:09

andr1o