在javascript中使用模块类型时,声明了“myvariable,但从未读取其值”

vfh0ocws  于 2021-09-23  发布在  Java
关注(0)|答案(0)|浏览(198)

myvariable是connect()

import {connect} from './store.js'

//message Error returned when I hovered: connect is declared but its value is never read

而store.js从core.js获取{connect}

//store.js
const {attach, connect,dispatch}=createStore(withLogger(reducer))
//...
export { connect }

函数createstore我从core.js获得

//core.js
export function createStore(reducer) { 
  return { 
    connect(selector = state => state) {
      return component => (props, ...args) => 
          component(Object.assign({}, props, selector(state), ...args))
    },

  }
}

我像编写库一样编写core.js。我在live server上打开它,它会向我发送一条消息:未捕获引用错误:在初始化之前无法访问“myvariable”
实际上,我已经用不同的方法修复了这个错误,但我仍然想知道问题出在哪里。希望大家能帮助我:((

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题