0.1.4 • Published 5 years ago

redux-hooked v0.1.4

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Usage

import { createStore } from 'redux';
import createApplication from 'redux-hooked';

const { useStore, useDispatch, useAction } = createApplication(store);

// Create your application specific hooks and export them
const getConnectionStatus = state => state.status;
export function useConnectionStatus() {
  const { name, age } = useStore((state) => ({
    name: state.name,
    age: state.age,
  }));

  return useStore(getConnectionStatus);
}

const updateUrl = url => ({ type: 'UPDATE_URL', payload: url });
export function useUpdateUrl() {
  return useAction(updateUrl);
}

export function useUserData(id) {
  const { name, age } = useStore(state => state.users[id], [id]);
}
0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago