swc-plugin-valtio
v1.0.1
Published
Valtio `useProxy` transformer for SWC.
Downloads
1
Readme
swc-plugin-valtio
Valtio useProxy
transformer for SWC.
Example
import { useProxy } from 'valtio/macro'
const Component = () => {
useProxy(state);
return (
<div>
{state.count}
<button onClick={() => ++state.count}>
+1
</button>
</div>
);
}
// The code above becomes the code below.
import { useSnapshot } from 'valtio';
const Component = () => {
const valtio_macro_snap_state = useSnapshot(state);
return (
<div>
{valtio_macro_snap_state.count}
<button onClick={() => ++state.count}>
+1
</button>
</div>
);
}
Tests
For MacOS
cargo test_darwin
For Linux
cargo test_linux
Release
npm run release -- --patch
npm run release -- --minor
npm run release -- --major