# babel-plugin-exp123

> Reactivars is a Babel plugin that lets you use a Svelte like syntax with Solid (a React version is a WIP).

Latest version **0.0.3** (published 2022-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-exp123
pnpm add babel-plugin-exp123
yarn add babel-plugin-exp123
bun add babel-plugin-exp123
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2022-01-08 |
| First published | 2022-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 62 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Oren Elbaum |
| Maintainers | orenelb |
| Keywords | babel, babel-plugin, solid, solid-js, react, reactivars, reactive variables |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-exp123
- Repository: https://github.com/orenelbaum/reactivars
- Homepage: https://github.com/orenelbaum/reactivars#readme
- Issues: https://github.com/orenelbaum/reactivars/issues
- npm.io page: https://npm.io/package/babel-plugin-exp123

## Dependencies (1)

- [@babel/types](https://npm.io/package/@babel/types.md) ^7.16.7

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2022-01-08
- 0.0.2 — 2022-01-08
- 0.0.1 — 2022-01-08

## README

# Reactivars

Reactivars is a Babel plugin that lets you use a Svelte like syntax with Solid (a React version is a WIP).


```jsx
const CounterChild = props =>
   <button onClick={() => props.$count++}>
      {props.$count}
   </button>

const CounterParent = () => {
   let $count = 0
   const incrementCount = () => $count++
   return <CounterChild {...{ $count }} />
}

//  ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓

import { createSignal } from 'solid-js'

const CounterChild = props => {
   <button onClick={() => props.$count[1](val => ++val)}>
      {props.$count[0]()}
   </button>

const CounterParent = () => {
   const $count = createSignal(0)
   const incrementCount = () => $count[1](val => ++val)
   return <CounterChild {...{ $count }} />
}
```

This is how it looks when used in conjunction with `babel-plugin-solid-undestructure`:

```jsx
const CounterChild = ({ $count }) =>
   <button onClick={() => $count++}>
      {$count}
   </button>

const CounterParent = () => {
   let $count = 0
   const incrementCount = () => $count++
   return <CounterChild {...{ $count }} />
}

//  ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓

import { createSignal } from 'solid-js'

const CounterChild = ({ $count }) => {
   <button onClick={() => $count[1](val => ++val)}>
      {$count[0]()}
   </button>

const CounterParent = () => {
   const $count = createSignal(0)
   const incrementCount = () => $count[1](val => ++val)
   return <CounterChild {...{ $count }} />
}
```


## Getting Started

```sh
npm i -D @reactivars/solid
```

In your Vite config, find the your vite-plugin-solid initialization (in the default Solid template it will be imported as `solidPlugin`).

The first argument this initialization function takes, is the options object.

Add this field to the initializer options:

```js
babel: {
	plugins: ["@reactivars/solid"]
} 
```

---
_Source: https://npm.io/package/babel-plugin-exp123 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
