react-code-dataset / tabler-react /example /src /ComponentDemo /react-element-to-jsx-string /index.js.flow
Download tabler-react/example/src/ComponentDemo/react-element-to-jsx-string/index.js.flow from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/example/src/ComponentDemo/react-element-to-jsx-string/index.js.flow
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/example/src/ComponentDemo/react-element-to-jsx-string/index.js.flow
-
curl -L -o index.js.flow https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/example/src/ComponentDemo/react-element-to-jsx-string/index.js.flow
1.03 kB
| /* @flow */ | |
| import formatTree from './formatter/formatTree'; | |
| import parseReactElement from './parser/parseReactElement'; | |
| import type { Element as ReactElement } from 'react'; | |
| import type { Options } from './options'; | |
| const reactElementToJsxString = ( | |
| element: ReactElement<any>, | |
| { | |
| filterProps = [], | |
| showDefaultProps = true, | |
| showFunctions = false, | |
| functionValue, | |
| tabStop = 2, | |
| useBooleanShorthandSyntax = true, | |
| useFragmentShortSyntax = true, | |
| sortProps = true, | |
| maxInlineAttributesLineLength, | |
| displayName, | |
| }: Options = {} | |
| ) => { | |
| if (!element) { | |
| throw new Error('react-element-to-jsx-string: Expected a ReactElement'); | |
| } | |
| const options = { | |
| filterProps, | |
| showDefaultProps, | |
| showFunctions, | |
| functionValue, | |
| tabStop, | |
| useBooleanShorthandSyntax, | |
| useFragmentShortSyntax, | |
| sortProps, | |
| maxInlineAttributesLineLength, | |
| displayName, | |
| }; | |
| return formatTree(parseReactElement(element, options), options); | |
| }; | |
| export default reactElementToJsxString; | |