Skip to content

Commit

Permalink
Add notes on how to type props and components
Browse files Browse the repository at this point in the history
Closes GH-2510.

Reviewed-by: Titus Wormer <[email protected]>
  • Loading branch information
karlhorky authored Jul 12, 2024
1 parent 044e8b2 commit 95ba33e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/docs/using-mdx.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {Note} from '../_component/note.jsx'

export const info = {
author: [
{github: 'wooorm', name: 'Titus Wormer', twitter: 'wooorm'}
Expand Down Expand Up @@ -206,6 +208,13 @@ console.log(React.createElement(Example, {name: 'Venus', year: 2021}))
console.log(<Example name="Mars" year={2022} />)
```
<Note type="info">
**Note**:
Users of the MDX VS Code extension can add type
checking of `props` with a JSDoc comment.
See [`mdx-js/mdx-analyzer`][mdx-analyzer] for more info.
</Note>
### Components
There is one special prop: `components`.
Expand Down Expand Up @@ -383,6 +392,13 @@ because in JSX syntax `a` is a literal tag name.
The third link (`#charlie`) is dashed and tomato,
as in JSX syntax `Link` is a reference.
<Note type="info">
**Note**:
Users of the MDX VS Code extension can add type
checking of provided and passed components with a JSDoc comment.
See [`mdx-js/mdx-analyzer`][mdx-analyzer] for more info.
</Note>
### Layout
There is one special component: the layout.
Expand Down Expand Up @@ -592,6 +608,8 @@ providers: pass components explicitly.
[what]: /docs/what-is-mdx/
[mdx-analyzer]: https://github.com/mdx-js/mdx-analyzer
[mdx-react]: /packages/react/
[mdx-preact]: /packages/preact/
Expand Down

0 comments on commit 95ba33e

Please sign in to comment.