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

Package Sidebar

Install

npm i autowrap-mobx-observer

Weekly Downloads

21

Version

1.1.0

License

ISC

Unpacked Size

39.3 kB

Total Files

18

Last publish

Collaborators

  • rikser123