Skip to content

Instantly share code, notes, and snippets.

@calvinfroedge
Created March 26, 2016 01:42
Show Gist options
  • Save calvinfroedge/8222a7a16c408756a78a to your computer and use it in GitHub Desktop.
Save calvinfroedge/8222a7a16c408756a78a to your computer and use it in GitHub Desktop.
Shorter function for 'connect' from 'react-redux'
import { connect } from 'react-redux'
const stateConnector = function(){
let stateKeys = Array.from(arguments);
let obj={};
return connect((state)=>{
stateKeys.forEach((key)=>{
obj[key] = state[key];
});
return obj;
})
}.bind(null);
export {stateConnector};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment