New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vtate

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vtate

Decentralized state management tool for vue3, which has perfect type hints and type verification.

  • 0.0.2
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

vstate

Decentralized state management tool for vue3, which has perfect type hints and type verification.

Usage

// user-profile.ts
import { createState } from 'vstate'
const initialState = {
  username: 'futengda',
}
export const userProfileState = createState({
  name: 'userinfo',
  initialState,
  reducers: {
    updateName: (state, payload) => {
      return {
        ...state,
        name: payload,
      }
    },
  },
})

// a.ts
import { userProfileState } from 'vstate'
import { userProfile } from './user-profile'

export default {
  setup() {
    const [userProfile] = useState(userProfileState)
    return () => <div>{userProfile.username}</div>
  }
}

// b.ts
import { userProfileState } from 'vstate'
import { userProfile } from './user-profile'

export default {
  setup() {
    const [_, dispatch, actions] = useState(userProfileState)
    function onClick() {
      dispatch(actions.updateName, 'fxxjdedd')
    }
    return () => {
      return <button onClick={onClick}>change username</button>
    }
  }
}

Todo

  • support dispatch a promise

License

MIT

FAQs

Package last updated on 25 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc