import React from 'react';
import { Provider } from 'react-redux';
import realStore from '../../App/Store';

/**
 * Creates a StoreProvider react component with the complete redux store (as in production)
 * Returns the StoreProvider and the store object to make possible to interact with it
 * (eg. dispatch actions, or read the state)
 * @return {{StoreProvider: (function(*): *), store: Store<any, AnyAction> & Store<S & {}, A> & {dispatch: any}}}
 */
export function createStoreProvider() {
    return {
        StoreProvider: function StoreProvider(props) {
            return <Provider store={realStore} {...props} />;
        },
        store: realStore,
    };
}
