@reatom/babel-plugin
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])