about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/util/redux_helpers.js
blob: 8eb338da703dacbe298de782ebb9b65c68f3aad0 (plain) (blame)
1
2
3
4
5
6
7
8
import { injectIntl } from 'react-intl';
import { connect } from 'react-redux';

//  Connects a component.
export function wrap (Component, mapStateToProps, mapDispatchToProps, options) {
  const withIntl = typeof options === 'object' ? options.withIntl : !!options;
  return (withIntl ? injectIntl : i => i)(connect(mapStateToProps, mapDispatchToProps)(Component));
}