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

0.0.2 • Public • Published

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')
    },
  },
});

Readme

Keywords

none

Package Sidebar

Install

npm i @hsjs/miniprogram-sparrow

Weekly Downloads

7

Version

0.0.2

License

MIT

Unpacked Size

5.86 kB

Total Files

9

Last publish

Collaborators

  • haishanh