0.1.0-alpha.1 ā€¢ Published 1 year ago

@m9ch/pumpkin v0.1.0-alpha.1

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

pumpkin

šŸŽƒ A SHIELD for pinia & Vue3.

Install

via npm, yarn or pnpm:

$ npm install --save @m9ch/pumpkin
# or yarn
$ yarn add @m9ch/pumpkin
# or pnpm
$ pnpm add @m9ch/pumpkin

Usage

  1. create a pumpkin instance:
import { createPumpkin } from '@m9ch/pumpkin'
import App from './App.vue'

const app = createPumpkin(App)
  1. define a model and mount it to the app:
const base = {
  namespace: 'base',
  state: () => ({
    msg: 'hello world',
  }),
  actions: {
    updateMsg (msg) {
      this.msg = msg
    },
  },
}

// mount the model to the app
app.model(base)
  1. connect it to a component:
const App = (props) => {
  return () => <h3>{props.msg}</h3>
}

const mapToProps = ({ base }) => ({
  msg: base.msg,
})

export default connect(mapToProps)(App)
  1. start the app!
app.start('#app')

checkout more details in ./examples.


made with :heart: by Mitscherlich