Skip to content
This repository has been archived by the owner on May 10, 2020. It is now read-only.

Allow actions to be passed to match Redux interface #14

Open
bebraw opened this issue May 16, 2016 · 0 comments
Open

Allow actions to be passed to match Redux interface #14

bebraw opened this issue May 16, 2016 · 0 comments

Comments

@bebraw
Copy link

bebraw commented May 16, 2016

Example:

@connect(({notes}) => ({notes}), {
  noteActions: NoteActions,
  laneActions: LaneActions
})

Demo implementation:

import React from 'react';
import connect from 'connect-alt';

const connectAdapter = (Component, state, actions) => {
  return class ConnectAdapter extends React.Component {
    render() {
      return <Component {...Object.assign({}, this.props, actions)} {...this.state} />;
    }
  };
};


export default (state, actions) => {
  return (target) => connect(state)(connectAdapter(target, state, actions));
};

It would be better if connect-alt did this, though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant