react-customized
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

react-customized

Rewrite react with directives

Install from the npm registry with your package manager:

npm install react-customized

Usage

Use with craco. craco.config.json :

    module.exports = {
        reactScriptsVersion: "react-scripts",
        babel: {
            presets: [
            [
                '@babel/preset-react',
                {
                    runtime: "automatic",
                    importSource: "react-customized",
                }
            ]
            ]
        }
    }

Now only one directive: r-if which means to mount the dom or not, similar to && or ? :

    <div r-if={true}>这是一个描述1</div>
    <div r-if={false}>这是一个描述2</div>
    const show = false
    <div r-if={show}>这是一个描述3</div>
    import React, { useState } from 'react';
    const [showBtn, setShowBtn] = useState<boolean>(false);
    useEffect(() => {
        setShowBtn(true)
    }, [])
    return (
        <div r-if={showBtn}>这是一个描述4</div>
    )

Package Sidebar

Install

npm i react-customized

Weekly Downloads

16

Version

1.0.3

License

ISC

Unpacked Size

7.18 kB

Total Files

12

Last publish

Collaborators

  • lilylovelife