找不到" store"

时间:2018-03-29 15:23:35

标签: reactjs redux react-redux

错误:

  

无法找到"存储"在" Connect(App)"的上下文或道具中。将根组件包装在< Provider>中,或者显式传递" store"作为" Connect(App)"的支柱。

我认为这是最后的出口声明的问题。

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { addReminder } from '../actions';

class App extends Component {
  constructor(props){
    super(props);
    this.state = {
        text: ''
    }
  }

  addReminder(){
    console.log('this', this);
  }
  render(){
    return (
      <div className="app">
        <div className="title">
          Reminder Pro
        </div>
        <div className="form-inline">
          <div className="form-group">
              <input
              className="form-control"
              placeholder="I have too.."
              onChange={event => this.setState({text: event.target.value})}
              />
          </div>
          <button
              type="button"
              className="btn btn-success"
              onClick= {() => this.addReminder()}
          >
          add a reminder     </button>
        </div>
      </div>
    )
  }
}

function mapDispatchToProps(dispatch){
  return bindActionCreators({addReminder}, dispatch);
}

export default connect(null, mapDispatchToProps) (App);

1 个答案:

答案 0 :(得分:1)

您似乎忘记使用create or replace TRIGGER Survey_Sample AFTER INSERT ON Survey_Cycle FOR EACH ROW DECLARE Survey_Cycle_Id Number; pSurvey_Cycle_Id Number; BEGIN Insert into Survey_Cycle_Sample (Survey_Cycle_ID, Stat_Method_Id, Create_Dt, Create_User_Id, Modify_Dt, Modify_User_Id, Effective_Dt, Inactive_Dt, Survey_Cycle_Sample_Tx) Values (:NEW.Survey_Cycle_Id, 0, trunc(sysdate, 'HH'), 1, null, null, null, null, null); Insert into Survey_Cycle_Period (Survey_Cycle_Id, Survey_Cycle_Period_Open_Dt, Survey_Cycle_Period_Close_Dt, Survey_Period_Type_Cd, Create_Dt, Create_User_Id, Modify_Dt, Effective_Dt, Inactive_Dt, Survey_Cycle_Period_Due_Dt, Survey_Cycle_Actual_Close_Dt) Values (:NEW.Survey_Cycle_Id, trunc(sysdate, 'HH'), trunc(sysdate + 1), 'Initial', sysdate, 1, null, null, null, sysdate - 1, null); END; 中的Provider组件了。像这样:

react-redux