这个 react-redux 出口如何连接?
How this react-redux exports connect?
根据这个 file connect
is imported from the connect module using the ES6 syntax. The connect.js 不导出 connect
但 createConnect
class.
如何从 connect.js 导出 connect
?
在 index.js
中使用了以下导入语句:
import connect from './connect/connect'
从 ./connect/connect
导入默认导出并将其分配给名称 connect
(您可以随意命名)。
在 connect.js
中默认导出为 Line 90:
export default createConnect()
这将导出 return value of the createConnect()
,即函数 connect
。请注意,名称并不重要,但给它起与模块相同的名称是常见且合乎逻辑的,从技术上讲,它甚至不需要名称。
有关默认导出和导入的详细信息,请参阅:Exploring ES6 - Default exports
根据这个 file connect
is imported from the connect module using the ES6 syntax. The connect.js 不导出 connect
但 createConnect
class.
如何从 connect.js 导出 connect
?
在 index.js
中使用了以下导入语句:
import connect from './connect/connect'
从 ./connect/connect
导入默认导出并将其分配给名称 connect
(您可以随意命名)。
在 connect.js
中默认导出为 Line 90:
export default createConnect()
这将导出 return value of the createConnect()
,即函数 connect
。请注意,名称并不重要,但给它起与模块相同的名称是常见且合乎逻辑的,从技术上讲,它甚至不需要名称。
有关默认导出和导入的详细信息,请参阅:Exploring ES6 - Default exports