jsxString2code: JSX string to React component code

Description Usage Arguments Value Note Examples

View source: R/jsxParser.R

Description

Given a JSX string, this function prints the code of the corresponding React component that can be used in chakraComponent.

Usage

1

Arguments

jsxString

JSX code given as a string

clipboard

whether to copy the output to the clipboard

Value

No return value, only prints the code in the console and copy it to the clipboard if clipboard = TRUE.

Note

Instead of using this function, rather use the RStudio addin provided by the package. Simply copy some JSX code to your clipboard, and select the 'JSX parser' addin in the RStudio Addins menu.

Examples

1
2
3
4
jsxString <- '<Input type="email" id="myinput" />'
jsxString2code(jsxString)
jsxString <- '<Button onClick={() => alert("hello")}>Hello</Button>'
jsxString2code(jsxString)

shinyChakraUI documentation built on Jan. 5, 2022, 5:08 p.m.