react-props-to-json-ts
v1.1.5
Published
react props to json schema
Maintainers
Readme
react-props-to-json-ts
React props to json schema used for form-reder
Install
yarn add react-props-to-json-ts --devor
npm install --save-dev react-props-to-json-tsHow to use
const propsToJSON = require('react-props-to-json-ts');
// input file path
const result = propsToJSON('filename.tsx');
console.log(result);API
(path, handleError)
| argument | type | required | description | | --------------- | --------------- | ------- | ----- | | path | string | true | The path of parsing file | handleError | (err: any) => void | false | Callback for handle the error |
Note
- The tool will skip the prop without
@titletag. - The component also need a
@titletag, otherwise will getnull. - If props is empty, will get a
nullvalue.
Example
pls follow the exmaple
Support types
| type | format |
| --------------- | --------------- |
| union | select |
| number | input number |
| boolean | checkbox |
| string | input |
| object | auto |
| array | auto |
| ReactNode | richtext |
