jsx-factory
v1.0.2
Published
A project to switch jsxFactory @ runtime
Downloads
10
Readme
jsxFactory
A project to switch jsxFactory @ runtime
usage:
tsconfig.json
{
"compilerOptions": {
...other options
"jsx": "react",
"jsxFactory": "customFactory"
}
}
set custom jsx factory or
import React from "react";
import { CUSTOM_FACTORY_CONFIGURATION } from "jsx-factory";
CUSTOM_FACTORY_CONFIGURATION.createElement = React.createElement;
use somewhere jsx
import { customFactory } from "jsx-factory";
export const Example = (
<div className={'example'} style={{textAlign: 'center'}}>expample</div>
)
=> result
import { customFactory } from "jsx-factory";
export const Example = (customFactory("div", { className: 'example', style: { textAlign: 'center' } }, "expample"));