Skip to content

Instantly share code, notes, and snippets.

@Kcin1993
Last active September 29, 2017 10:47
Show Gist options
  • Save Kcin1993/508fe9a0c9ebb68d61dcf595a4c8d754 to your computer and use it in GitHub Desktop.
Save Kcin1993/508fe9a0c9ebb68d61dcf595a4c8d754 to your computer and use it in GitHub Desktop.
Redux Connect
import React, {Component} from 'react';
import { connect } from 'redux';
import { certainAction } from '../actions';

class Example extends Component {
  render() {
    return (
      <div>Example</div>
    )
  }
}

// [1] --- Without shortcut
const mapDispatchToProps = {
  certainAction: certainAction,
}
export default connect(null, mapDispatchToProps)(Example)

// [2] --- with shorcut
export default connect(null, {certainAction})(Example)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment