[SOLVED] WebApp Plugin Error when using mattermost-redux library

Hi, I’m getting this error on my browser console:

 helloworld_bundle.js:13158 Uncaught TypeError: __webpack_require__.i(...) is not a function

So I’m importing a function from https://github.com/mattermost/mattermost-redux/blob/master/src/actions/channels.js#L100:

import {CreateDirectChannel} from 'mattermost-redux/actions/channels';

And my handler calls:

handleDirectMessage() {
  CreateDirectChannel(this.props.user.id,this.props.cur_user.id);
}

The error on the console is:

helloworld_bundle.js:13158 Uncaught TypeError: __webpack_require__.i(...) is not a function
at ProfilePopover.handleDirectMessage (helloworld_bundle.js:13158)

And the source of the error is:

        value: function handleDirectMessage() {
        __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9_mattermost_redux_actions_channels__["CreateDirectChannel"])(this.props.user.id, this.props.cur_user.id);
    }

Any information on how to solve this issue?

Ok solved, for others that encountered the same issue, the code should be:

const dispatch = store.dispatch;
const getState = store.getState;

  handleDirectMessage = async () => {
      const result = await ChannelActions.createDirectChannel(this.props.user.id,this.props.cur_user.id)(dispatch, getState);
}