Sha256: 5ae44bf4abaf946bec84cba04468e4823c31db74c25c2b7071fdcf6dc7508621
Contents?: true
Size: 720 Bytes
Versions: 5
Compression:
Stored size: 720 Bytes
Contents
import React, { Component } from 'react'; import { has } from 'lodash'; import { Provider } from 'react-redux'; import { MemoryRouter } from 'react-router'; import createStore from 'test/mock_store'; const defaultStore = { router: { location: { pathname: '/' } } }; const connectWrapper = (WrappedComponent, store = defaultStore) => { class Wrapper extends Component { render() { const providerStore = has(store, 'getState') ? store : createStore(store); return ( <Provider store={providerStore}> <MemoryRouter> <WrappedComponent {...this.props} /> </MemoryRouter> </Provider> ); } } return Wrapper; }; export default connectWrapper;
Version data entries
5 entries across 5 versions & 1 rubygems