File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
packages/website/pages/docs/getting-started Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -29,3 +29,42 @@ yarn add react-docgen
2929
3030 </Tab >
3131</Tabs >
32+
33+ ## Usage
34+
35+ Here is an easy example
36+
37+ ``` ts filename="index.tsx" copy
38+ import { parse } from ' react-docgen' ;
39+
40+ const code = `
41+ /** My first component */
42+ export default ({ name }: { name: string }) => <div>{{name}}</div>;
43+ ` ;
44+
45+ const documentation = parse (code );
46+
47+ console .log (documentation );
48+ ```
49+
50+ The documentation that this script is going to print will look like this. If you
51+ want to know more about the structure you can head over to the reference of the
52+ [ Documentation] ( ../reference/documentation )
53+
54+ ``` json
55+ [
56+ {
57+ "description" : " My first component" ,
58+ "methods" : [],
59+ "props" : {
60+ "name" : {
61+ "required" : true ,
62+ "tsType" : {
63+ "name" : " string"
64+ },
65+ "description" : " "
66+ }
67+ }
68+ }
69+ ]
70+ ```
You can’t perform that action at this time.
0 commit comments