jsxString2code {shinyChakraUI}R Documentation

JSX string to React component code

Description

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

Usage

jsxString2code(jsxString, clipboard = TRUE)

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

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

[Package shinyChakraUI version 1.1.1 Index]