React-> React Boilerplate:上述错误发生在<connect(languageprovider)>组件中:

时间:2018-11-07 10:31:46

标签: reactjs

我是React的新手(这只是我从事此工作的第三天)。 我正在使用React Boilerplate来更好地处理项目。 我正在使用WP进行API调用,并且网络上的一切似乎都很好。 我共享index.js代码是因为我认为Firefox对该文件感到愤怒,但我真的不知道为什么。

import React from 'react';
import PropTypes from 'prop-types';
import { Helmet } from 'react-helmet';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { createStructuredSelector } from 'reselect';
import injectSaga from 'utils/injectSaga';
import injectReducer from 'utils/injectReducer';
import DomenicoDatas from 'components/DomenicoDatas';
import { makeSelectError, makeSelectLoading } from '../App/selectors';
import makeSelectDomenico from './selectors';
import messages from './messages';
import { loadDomenico } from './actions';
import reducer from './reducer';
import saga from './saga';

/* eslint-disable react/prefer-stateless-function */
export class Domenico extends React.PureComponent {
  componentWillMount() {
    this.props.domenicoAction();
  }

  render() {
    const { loading, error } = this.props;
    const domenicoDatasProps = {
      loading,
      error,
    };
    return (
      <div>
        <Helmet>
          <title>Domenico</title>
          <meta name="description" content="Description of Domenico" />
        </Helmet>
        <FormattedMessage {...messages.header} />
        <DomenicoDatas {...domenicoDatasProps} />
        <div>
          {this.props.domenico.result.length &&
            this.props.domenico.result[0].name}
        </div>
      </div>
    );
  }
}

Domenico.propTypes = {
  // domenico: PropTypes.func,
  loading: PropTypes.bool,
  error: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
};

const mapStateToProps = createStructuredSelector({
  domenico: makeSelectDomenico(),
  loading: makeSelectLoading(),
  error: makeSelectError(),
});

function mapDispatchToProps(dispatch) {
  return { domenicoAction: () => dispatch(loadDomenico()) };
}

const withConnect = connect(
  mapStateToProps,
  mapDispatchToProps,
);

const withReducer = injectReducer({ key: 'domenico', reducer });
const withSaga = injectSaga({ key: 'domenico', saga });

export default compose(
  withReducer,
  withSaga,
  withConnect,
)(Domenico);

我仅在Firefox上有这种错误。在Chrome上,一切正常,我不明白为什么。

img-error

0 个答案:

没有答案