autowrap-mobx-observer
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Autowrap-mobx-observer

Autowrap react components in mobx observer hoc. Support functional components.

Prerequisites

  • @babel/core: ^7.23.3
  • babel jsx
  • typescript tscofngg: jsx: preserve

Usage

{
    "compilerOptions": {
        "baseUrl": "./src",
        "jsx": "preserve"
    },
    "
}
const babelConfig = require("path-to-config");
babelConfig.plugins = [...babelConfig.plugins, "./node_modules/autowrap-mobx-observer"];
module.exports = babelConfig;

Result

Before

import { react } from 'react';

const func = () => {
    console.log(222);
};

After

import { observer } from 'mobx-react-lite';
import { react } from 'react';

const func = observer(() => {
    console.log(222);
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    8
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    8
  • 1.0.0
    0

Package Sidebar

Install

npm i autowrap-mobx-observer

Weekly Downloads

8

Version

1.1.0

License

ISC

Unpacked Size

39.3 kB

Total Files

18

Last publish

Collaborators

  • rikser123