An ECMAScript module containing a React component with JSX to render it.
Presents a convenient API for consumers to add common transforms to React components and the JSX in them, in a semantic way.
-
TargetableReactComponent
- .addJSXClassName(element, className, [options]) ⇒
this - .addReactLazyImport(modulePath, [localName]) ⇒
string - .appendJSX(element, newChild, [options]) ⇒
this - .insertAfterJSX(element, newSibling, [options]) ⇒
this - .insertBeforeJSX(element, newSibling, [options]) ⇒
this - .prependJSX(element, newChild, [options]) ⇒
this - .removeJSX(element, [options]) ⇒
this - .removeJSXProps(element, propNames, [options]) ⇒
this - .replaceJSX(jsx, replacement, [options]) ⇒
this - .setJSXProps(element, props, [options]) ⇒
this - .surroundJSX(element, newParent, [options]) ⇒
this
- .addJSXClassName(element, className, [options]) ⇒
Add a CSS classname to a JSX element. Unlike setting the className prop, this is non-destructive. It will append the classname to any existing classnames, instead of replacing it.
Chainable
Returns: Parameters
stringstringclassname in the file. If that identifier doesn't exist, it'll cause a ReferenceError.JSXModifierOptionsAdd a new named dynamic import of another React component, using the lazy wrapper for use with React.Suspense.
Returns: string — Name of the local binding of the element, to be used in JSX operations.
Parameters
stringstringAppend a JSX element to the children of element.
Chainable
Returns: Parameters
stringstringJSXModifierOptionsInsert a JSX element after element.
Chainable
Returns: Parameters
stringstringJSXModifierOptionsInsert a JSX element before element.
Chainable
Returns: Parameters
stringstringJSXModifierOptionsPrepend a JSX element to the children of element.
Chainable
Returns: Parameters
stringstringJSXModifierOptionsRemove the JSX node matched by 'element'.
Chainable
Returns: Parameters
stringJSXModifierOptionsRemove JSX props from the element if they match one of the list of names.
Chainable
Returns: Parameters
stringArray.<string>JSXModifierOptionsReplace a JSX element with different code.
Chainable
Returns: Parameters
string<Route path="/">.stringJSXModifierOptionsSet JSX props on a JSX element.
Chainable
Returns: Parameters
stringobjectJSXModifierOptionsExample
file.setJSXProps('Tab colorScheme="dark"', {
colorScheme: '"light"',
className: '{classes.tabs}'
})
Wrap a JSX element in an outer element.
Chainable
Returns: Parameters
stringstringJSXModifierOptionsSource Code: pwa-studio/packages/pwa-buildpack/lib/WebpackTools/targetables/TargetableReactComponent.js