Skip to content

Is not working with react-redux 6 #9

Closed
@rcanessa89

Description

@rcanessa89

Is not working with react redux 6.0.1, the problem is the store value in the context, is coming undefined, looks like the current version of "ui-router/redux" is using the legacy React context API.

I builded this solution for my project but the context API should be change it for future versions of React.

import store from '@store';
import { pushStateLocationPlugin, UIView } from '@uirouter/react';
import { ConnectedUIRouter } from '@uirouter/redux/lib/react';
import * as PropTypes from 'prop-types';
import * as React from 'react';
import config from './config';
import { router } from './index';
import states from './states';

const plugins = [
  pushStateLocationPlugin
];

export default class AppRouter extends React.Component<any> {
  public static childContextTypes = {
    store: PropTypes.object
  };

  public getChildContext() {
    return {
      store,
    };
  }

  public render() {
    return (
      <ConnectedUIRouter
        router={router}
        plugins={plugins}
        states={states}
        config={config}
      >
        <UIView />
      </ConnectedUIRouter>
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions