我在react-native中有一个应用程序,在Asp.net中有一个服务器,在从SignalR接收到新数据后,我试图更新UI中显示的数据,我实现了Redux以拥有一个存储,但是数据不会更新,而是在收到数据时不会在Redux中调用操作,而是在UI中永远不会显示更改。
这是我在信号文件中的功能
const appR = () => (
<Provider store = { store }>
<App />
</Provider>)
AppRegistry.registerComponent(appName, () => appR);
这是我的信号文件:
const store = configureStore();
let connection = signalr.hubConnection('http://localhost/proApi');
connection.logging = true;
let proxy = connection.createHubProxy('Hub');
export function init(id){
connection.qs={"user-name":1};
proxy.on('SendCount', (argOne) => {
store.dispatch({type:COUNTER_CHANGE,payload:1});
console.log('message-from-server');
});
connection.start()
.done(() => {
console.log('Now connected, connection ID=' + connection.id);
}).fail(() => {
console.log('Failed');
});}
有人可以向我解释什么是错误的,以及如何解决它。非常感谢。