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 🙏

© 2026 – Pkg Stats / Ryan Hefner

redux-vue

v0.8.2

Published

Vue Redux binding higher order component

Downloads

53

Readme

redux-vue

CI npm npm downloads License: MIT

Redux bindings for Vue 2 — a higher-order component (HOC) that connects Vue components to a Redux store, similar to react-redux's connect().

Vue 2 only. This library targets Vue 2.x. For Vue 3, use Pinia or vuex 4.x.


Install

npm install redux-vue
# or
yarn add redux-vue

Setup

Register the plugin on your root Vue instance so all child components can access the store:

// main.js
import Vue from 'vue';
import { reduxStorePlugin } from 'redux-vue';
import store from './store';
import App from './App';

Vue.use(reduxStorePlugin);

new Vue({
  store,
  render: h => h(App),
});

Usage

connect(mapStateToProps, mapDispatchToProps, [mergeProps])(Component)

Wraps a Vue component and injects store state and dispatch functions as props.

// components/TodoApp.js
import { connect } from 'redux-vue';

const TodoApp = {
  props: {
    todos: { type: Array },
    addTodo: { type: Function },
  },
  render(h) {
    return (
      <div>
        <ul>{this.todos.map(t => <li>{t}</li>)}</ul>
        <button onClick={() => this.addTodo('new item')}>Add</button>
      </div>
    );
  },
};

const mapStateToProps = state => ({ todos: state.todos });

const mapDispatchToProps = dispatch => ({
  addTodo: todo => dispatch({ type: 'ADD_TODO', payload: todo }),
});

export default connect(mapStateToProps, mapDispatchToProps)(TodoApp);

Single-file components

// components/App.js
import { connect } from 'redux-vue';
import Comp from './Comp.vue';

const mapStateToProps = state => ({ count: state.count });
const mapDispatchToProps = dispatch => ({
  increment: () => dispatch({ type: 'INCREMENT' }),
});

export default connect(mapStateToProps, mapDispatchToProps)(Comp);

API

connect([mapStateToProps], [mapDispatchToProps], [mergeProps])(Component)

| Argument | Type | Description | | --------------------------------------- | --------------------- | -------------------------------------------------------- | | mapStateToProps(state, ownAttrs) | Function | Maps store state to props. Called on every store update. | | mapDispatchToProps(dispatch) | Function | Maps dispatch calls to props. | | mergeProps(stateProps, dispatchProps) | Function (optional) | Combine or rename keys before they reach the child. |

Pass-through props — props not declared in the map functions are forwarded to the wrapped component automatically.

Slots — slot content on the connected wrapper is forwarded to the inner component.

reduxStorePlugin

A Vue plugin. Call Vue.use(reduxStorePlugin) once with store set on the root instance. All descendant components will have this.$store available.


Examples

mergeProps

const mergeProps = (stateProps, dispatchProps) => ({
  fullCount: stateProps.count * 2,
  onAdd: dispatchProps.addTodo,
});

export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(App);

Pass-through props

<!-- nonMappedProp is not in mapStateToProps — it still reaches the wrapped component -->
<ConnectedApp nonMappedProp="Foo" />

Slots

<ConnectedApp>
  <span>This slot content is forwarded to the inner component</span>
</ConnectedApp>

Store example

// store.js
import { createStore } from 'redux';

const initialState = { todos: [] };

const reducer = (state = initialState, action) => {
  switch (action.type) {
    case 'ADD_TODO':
      return { ...state, todos: [...state.todos, action.payload] };
    default:
      return state;
  }
};

export default createStore(reducer);

Development

git clone https://github.com/nadimtuhin/redux-vue.git
cd redux-vue
npm install
npm test

Tests live in src/*.spec.js and use Mocha. See CONTRIBUTING.md for contribution guidelines.


License

MIT © Nadim Tuhin