我希望从.js文件中公开一个函数,在该函数中我更愿意访问商店中的变量.
代码片段: -
import { connect } from 'react-redux';
function log(logMessage) {
const {environment} = this.props;
console.debug('environment' + environment + logMessage );
....
}
function mapStateToProps(state) {
return {
environment : state.authReducer.environment
};
}
export default function connect(mapStateToProps)(log);
Run Code Online (Sandbox Code Playgroud)
我有很多组件,通过附加类connect,我可以附加功能connect()吗?
目标很简单
问题:数据是通过调用者中的 websocket 接收的,但从未作为流传回提供者或控制器以反映更改
示例代码
实际调用者 orderdata.dart
@override
Stream<dynamic> subscribe({
String query,
Map<String, dynamic> variables,
}) async* {
debugPrint('===->subscribe===');
// it can be any stream here, http or file or image or media
final Stream<GraphQLResponse<String>> operation = Amplify.API.subscribe(
GraphQLRequest<String>(
document: query,
variables: variables,
),
onEstablished: () {
debugPrint(
'===->subscribe onEstablished …Run Code Online (Sandbox Code Playgroud)