mirror of
https://github.com/mdx-js/mdx.git
synced 2024-09-19 03:17:10 +03:00
Add notes on how to type props and components
Closes GH-2510. Reviewed-by: Titus Wormer <tituswormer@gmail.com>
This commit is contained in:
parent
044e8b2a27
commit
95ba33e154
@ -1,3 +1,5 @@
|
||||
import {Note} from '../_component/note.jsx'
|
||||
|
||||
export const info = {
|
||||
author: [
|
||||
{github: 'wooorm', name: 'Titus Wormer', twitter: 'wooorm'}
|
||||
@ -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`.
|
||||
@ -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.
|
||||
@ -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/
|
||||
|
Loading…
Reference in New Issue
Block a user