1.0.2 • Published 2 years ago

jsx-factory v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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"));