npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-redux-adapter

v1.0.5

Published

A simple wrapper on `Redux` and makes it possible to use `Redux` store on Vue.

Downloads

42

Readme

Vue Redux Adapter

A simple wrapper on Redux and makes it possible to use Redux store on Vue.

npm version

Demo Counter App

Install

Install vue-redux-adapter package

npm install vue-redux-store

Install redux package

npm install @reduxjs/toolkit

API

createPlugin()

A Vue plugin that injects store instance to app.

Example

  • Define store
        // src/counter-store.ts
    import {configureStore, createSlice} from '@reduxjs/toolkit'
    const counter = createSlice({
      name: 'counter',
      initialState: {
        count: 0
      },
      initialState: { count: 0 },
      reducers: {
        increment: state => {
          state.count++
        },
        decrement: state => {
          state.count--
        },
        reset: _ => ({
          count: 0,
        }),
      },
    })
    const reduxStore = configureStore({
      reducer: {
        counter: counter.reducer,
      },
    }) 
  • provide store to context
    app.use(createPlugin(reduxStore))
    

useSelector()

Creates a computed store from part of your store using selector function.

useStore(), useDispatch()

Hooks to grab store, dispatch from plugin

Example

  <script setup lang="ts">
  import { useSelector } from './lib'
  import { actions, useStore } from './store'
  import type { RootState } from './store'

  const store = useStore()
  const dispatch = store.dispatch

  const count = useSelector((s: RootState) => s.counter.count)
  const multiplier = ref(1)
  // select along with built-in ref
  const multiplied = useSelector(
    () => multiplier.value,
    (s: RootState, m) => s.counter.count * m
  )
  </script>

  <template>
    <div>
      <button @click="dispatch(actions.decrement())" data-testid="decrement_btn">decrement</button>
      &nbsp;
      <span data-testid="display_count">
        {{ count }}
      </span>
      &nbsp;
      <button @click="dispatch(actions.increment())" data-testid="increment_btn">increment</button>
    </div>
    <br />
    <div>
      <p>
        Multiplied <span data-testid="display_multiplied"> {{ multiplied }} </span>
      </p>
      <button data-testid="mult1_btn" @click="multiplier = 1">multiply 1</button>
      <button data-testid="mult2_btn" @click="multiplier = 2">multiply 2</button>
      <button data-testid="mult3_btn" @click="multiplier = 3">multiply 3</button>
    </div>
  </template>

Contributing ✨

Interested in contributing to this repo? Check out our and submit a PR for a new feature/bug fix.

A big shoutout to all our contributors! You could be here too! ✨