React Native:无法使用redux-saga使用`store.dispatch`

时间:2017-11-25 13:38:57

标签: react-native redux-saga

我正在使用react-native 0.50.3,我正在尝试发送导航操作,但是我收到此错误:

  

undefined不是对象(评估'_reducers2.default')

 private void billdeleteActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    try{
        Class.forName("oracle.jdbc.driver.OracleDriver");
        int id=Integer.parseInt(billidtext.getText());
        try (//step2 create  the connection object
            Connection con = DriverManager.getConnection("jdbc:oracle:thin:localhost:xe","hr","****")) {
            Statement stmt=con.createStatement();
            stmt = con.createStatement();
            String sql = "DELETE FROM bill " +
            "WHERE bid = ('"+id+"')";
            int w=stmt.executeUpdate(sql);
            if(w!=0)
            JOptionPane.showMessageDialog(null,"Deleted Successfully!"); //this is displayed successfully
            else
            JOptionPane.showMessageDialog(null,"value does not exists!");// this is displayed successfully
            supplieridtext.setText("");

            //view trigger
            String sql1="SELECT * FROM bill";

            stmt = con.createStatement();

            ResultSet rs = stmt.executeQuery(sql1);
            //STEP 5: Extract data from result set
            billtable.setModel(DbUtils.resultSetToTableModel(rs));
            rs.close();

            //step5 close the connection object
        }
    }catch( ClassNotFoundException | SQLException e){ 
        JOptionPane.showMessageDialog(null,"no value entered!");}    //this line is not displayed when the text field is empty
}

configureStore.js:

import configureStore from '../../../configureStore'

const store = configureStore(); <-- error points here

class childComp extends Component {
    //...
    goToProfile = () => {
       store.dispatch(NavigationActions.navigate({routeName: 'Profile'}));
    }
}
export default childComp;

我已经在import { createStore, applyMiddleware } from 'redux'; import app from './src/reducers'; import createSagaMiddleware from 'redux-saga'; import rootSaga from './sagas'; const sagaMiddleware = createSagaMiddleware() export default function configureStore(){ const store = createStore(app, applyMiddleware(sagaMiddleware)) <-- also error points here sagaMiddleware.run(rootSaga) return store; } 中使用了store.dispatch,但效果很好。

减速

index.js

0 个答案:

没有答案