@wiredcraft/miniprogram-sparrow
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Install

yarn add @wiredcraft/miniprogram-sparrow

Usage

// store/name.js

import { atom } from "sparrow";

export const firstName = atom("Jack");

// the action
export function updateFirstName(name) {
  write(firstName, name);
}
// components/hello.js
import { write, behavior as sparrow } from "sparrow";
import { firstName, updateFirstName } from "./store/name";

Component({
  atoms: { firstName },

  behaviors: [sparrow],
  lifetimes: {
    attached() {
      console.log(this.firstName);
    },
  },
  methods: {
    handleButtonOnTap() {
      updateFirstName("Rose");
    },
  },
});

/@wiredcraft/miniprogram-sparrow/

    Package Sidebar

    Install

    npm i @wiredcraft/miniprogram-sparrow

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    13.3 kB

    Total Files

    12

    Last publish

    Collaborators

    • agreatfool
    • stefan1105
    • apexblade
    • miffyliye
    • dejandoder
    • linrz
    • koknikol
    • eronekogin
    • aleksandar5595
    • shuaibird
    • dmwc
    • kunlun8809
    • draganmijajilovic
    • wiredcraft-bot
    • xavierchow
    • kaleocheng
    • flyingant
    • superbogy
    • lalawow
    • juhas