@reatom/babel-plugin

1.0.0 • Public • Published

reatom logo

@reatom/babel-plugin

npm

Open in docs

Install

npm i -D @reatom/babel-plugin

or

yarn add @reatom/babel-plugin --dev

NOTE. @reatom/babel-plugin depends on and works with @reatom/core.

Usage

Step 1.

Add the plugin via .babelrc or babel-loader.

{
  "plugins": ["@reatom/babel-plugin"]
}

Step 2.

import { declateAction, declareAtom, map, combine } from '@reatom/core' 

const myAction = declareAction()
const myAtom = declareAtom({}, () => [])
const mySelector = map(myAtom, atomState => atomState)
const myCombine = combine([myAtom, mySelector])

Will be converted to:

import { declateAction, declareAtom, map, combine } from '@reatom/core' 

const myAction = declareAction('myAction')
const myAtom = declareAtom('myAtom', {}, () => [])
const mySelector = map('mySelector', myAtom, atomState => atomState)
const myCombine = combine('myCombine', [myAtom, mySelector])

Readme

Keywords

Package Sidebar

Install

npm i @reatom/babel-plugin

Weekly Downloads

308

Version

1.0.0

License

MIT

Unpacked Size

5.06 kB

Total Files

4

Last publish

Collaborators

  • artalar